1 Introduction

This part includes descriptive statistics after feature extraction, data cleaning, and preparation.

2 Data preparation

2.1 Source setup

########## folders ##########
# current folder (first go to session -> set working directory -> to source file location)
parentfolder <- dirname(getwd())

data          <- paste0(parentfolder, '/MultIS_data/')
audiodata     <- paste0(parentfolder, '/audio_processed/')
syllables     <- paste0(audiodata,    'syllables/')
dataworkspace <- paste0(parentfolder, '/data_processed/')
datamerged    <- paste0(parentfolder, '/data_merged/')
datasets      <- paste0(parentfolder, '/datasets/')
models        <- paste0(parentfolder, '/models/')
plots         <- paste0(parentfolder, '/plots/')
scripts       <- paste0(parentfolder, '/scripts/')

########## source file ##########

#source(paste0(scripts, "adjectives-preparation.R"))

#################### packages ####################
# Data Manipulation
library(tibble)
library(stringr)
library(tidyverse) # includes readr, tidyr, dplyr, ggplot2

# Plotting
library(ggforce)
library(ggpubr)
library(gridExtra)

colorBlindBlack8  <- c("#000000", "#E69F00", "#56B4E9", "#009E73", 
                       "#F0E442", "#0072B2", "#D55E00", "#CC79A7")

2.2 Load in data frames

participant_info <- read_delim(paste0(data,"ParticipantInfo_GERCAT.csv"), delim = ";")

# Load the information about duration of each segment (if needed)
data_df <- read.table(paste0(syllables, "fileDurationsDF.csv"), header = TRUE, sep = ',')

# Load cleaned syllable data
data <- read_csv(paste0(datasets, "data_cleaned.csv"))

# Load cleaned targets data
targets <- read_csv(paste0(datasets, "targets.csv"))

# Load cleaned targets with pre-post data
data_prepost <- read_csv(paste0(datasets, "data_prepost.csv"))

2.3 You can add participant info

# Process participant_info so that participant number column is only number
participant_info$Participant <- parse_number(participant_info$Participant)

# Merge the dataframes by "Participant" and "Language"
# Exchange META to the dataframe of your liking
# META <- merge(META, participant_info, by = c("Participant", "Language"), all.x = TRUE)

3 Descriptive statistics and visualizations

How many NAs are there?

# Columns to process
columns_to_process <- c(
  "duration", "duration_noSilence", "ampl_median", "ampl_noSilence_median", "env_slope",
  "pitch_median", "pitch_sd", "f0_slope", "f1_freq_median", "f2_freq_median",
  "specCentroid_median", "entropy_median", "HNR_median", "amEnvDep_median", "fmDep_median",
  "pitch_median_norm", "pitch_sd_norm", "f0_slope_norm", "f1_freq_median_norm", "f2_freq_median_norm",
  "syllTextPre", "durationPre", "duration_noSilencePre", "ampl_medianPre",
  "ampl_noSilence_medianPre", "env_slopePre", "pitch_medianPre", "pitch_sdPre", "f0_slopePre",
  "f1_freq_medianPre", "f2_freq_medianPre", "specCentroid_medianPre", "entropy_medianPre", "HNR_medianPre",
  "amEnvDep_medianPre", "fmDep_medianPre", "pitch_median_normPre", "pitch_sd_normPre", "f0_slope_normPre",
  "f1_freq_median_normPre", "f2_freq_median_normPre", "syllTextPost", "durationPost", "duration_noSilencePost",
  "ampl_medianPost", "ampl_noSilence_medianPost", "env_slopePost", "pitch_medianPost", "pitch_sdPost", "f0_slopePost",
  "f1_freq_medianPost", "f2_freq_medianPost", "specCentroid_medianPost", "entropy_medianPost", "HNR_medianPost",
  "amEnvDep_medianPost", "fmDep_medianPost", "pitch_median_normPost", "pitch_sd_normPost", "f0_slope_normPost",
  "f1_freq_median_normPost", "f2_freq_median_normPost"
)

# Ensure columns to process are numeric
columns_to_process <- columns_to_process[columns_to_process %in% names(data_prepost)]
columns_to_process <- columns_to_process[sapply(data_prepost[columns_to_process], is.numeric)]

# Function to calculate raw number and proportion of NAs
calculate_na_stats <- function(df, columns) {
  na_counts <- colSums(is.na(df[, columns]))
  total_counts <- nrow(df)
  proportions <- na_counts / total_counts * 100
  return(data.frame("NA_Count" = na_counts, "Proportion" = proportions))
}

# Initial NA stats
na_stats_before <- calculate_na_stats(data_prepost, columns_to_process)
print(na_stats_before)
##                           NA_Count  Proportion
## duration                         0  0.00000000
## duration_noSilence               1  0.02178649
## ampl_median                      1  0.02178649
## ampl_noSilence_median            1  0.02178649
## env_slope                       44  0.95860566
## pitch_median                   288  6.27450980
## pitch_sd                       288  6.27450980
## f0_slope                       228  4.96732026
## f1_freq_median                   1  0.02178649
## f2_freq_median                   1  0.02178649
## specCentroid_median              1  0.02178649
## entropy_median                   1  0.02178649
## HNR_median                      95  2.06971678
## amEnvDep_median                  1  0.02178649
## fmDep_median                   461 10.04357298
## pitch_median_norm              288  6.27450980
## pitch_sd_norm                  288  6.27450980
## f0_slope_norm                  228  4.96732026
## f1_freq_median_norm              1  0.02178649
## f2_freq_median_norm              1  0.02178649
## durationPre                    200  4.35729847
## duration_noSilencePre          200  4.35729847
## ampl_medianPre                 200  4.35729847
## ampl_noSilence_medianPre       200  4.35729847
## env_slopePre                   351  7.64705882
## pitch_medianPre                658 14.33551198
## pitch_sdPre                    658 14.33551198
## f0_slopePre                    676 14.72766885
## f1_freq_medianPre              200  4.35729847
## f2_freq_medianPre              200  4.35729847
## specCentroid_medianPre         200  4.35729847
## entropy_medianPre              200  4.35729847
## HNR_medianPre                  357  7.77777778
## amEnvDep_medianPre             200  4.35729847
## fmDep_medianPre               1217 26.51416122
## pitch_median_normPre           658 14.33551198
## pitch_sd_normPre               658 14.33551198
## f0_slope_normPre               676 14.72766885
## f1_freq_median_normPre         200  4.35729847
## f2_freq_median_normPre         200  4.35729847
## durationPost                   318  6.92810458
## duration_noSilencePost         318  6.92810458
## ampl_medianPost                318  6.92810458
## ampl_noSilence_medianPost      318  6.92810458
## env_slopePost                  405  8.82352941
## pitch_medianPost              1040 22.65795207
## pitch_sdPost                  1040 22.65795207
## f0_slopePost                   897 19.54248366
## f1_freq_medianPost             318  6.92810458
## f2_freq_medianPost             318  6.92810458
## specCentroid_medianPost        318  6.92810458
## entropy_medianPost             318  6.92810458
## HNR_medianPost                 631 13.74727669
## amEnvDep_medianPost            318  6.92810458
## fmDep_medianPost              1356 29.54248366
## pitch_median_normPost         1040 22.65795207
## pitch_sd_normPost             1040 22.65795207
## f0_slope_normPost              897 19.54248366
## f1_freq_median_normPost        318  6.92810458
## f2_freq_median_normPost        318  6.92810458

3.1 Frequencies and proportions

How many target syllables do we have per language?

targets %>%
  group_by(language) %>%
  summarize(Cumulative_Count = n())

And how are they distributed across perceived prosodic prominence ratings?

syll_per_pros <- 
  targets %>% 
  group_by(language, percProm) %>%
  summarize(Count = n()) %>%
  mutate(Proportion = Count / sum(Count))

## Count
ggplot(syll_per_pros, aes(x = percProm, y = Count, fill = language)) +
  geom_bar(stat = "identity", position = "dodge", alpha = 0.7) +
  labs(#title = "Count of Syll per Language and Prominence",
       x = "Perceived prominence", y = "Count") +
  scale_fill_manual(values = colorBlindBlack8) + 
  theme_minimal()

ggsave(filename = paste0(plots, "prominence_count.png"), plot = last_plot(), width = 6, height = 4)

## Proportion
ggplot(syll_per_pros, aes(x = percProm, y = Proportion, fill = language)) +
  geom_bar(stat = "identity", position = "dodge", alpha = 0.7) +
  labs(#title = "Proportion of Syll per Language and Prominence",
       x = "Perceived prominence", y = "Proportion") +
  scale_fill_manual(values = colorBlindBlack8) + 
  theme_minimal()

ggsave(filename = paste0(plots, "prominence_prop.png"), plot = last_plot(), width = 6, height = 4)

3.2 Averages prominence

3.2.1 Duration

What is the average duration across the different prosodic prominence ratings in Catalan vs in German?

targets %>% 
  group_by(language, percProm) %>%
  summarize(avg_duration = mean(duration, na.rm = TRUE))

Let’s plot it.

ggplot(targets %>% filter(!is.na(percProm)), aes(x = language, y = duration, fill = as.factor(percProm))) +
  geom_violin(scale = "width", trim = FALSE, alpha = 0.3) +
  geom_boxplot(width = 0.1, outlier.shape = NA, position = position_dodge(width = 0.9), alpha = 0.5) +
  labs(
    #title = "Duration of Prosodic Prominence Ratings by Language",
    x = "Language",
    y = "Duration (total)",
    fill = "Prosodic prominence"
  ) +
  scale_fill_manual(values = colorBlindBlack8) +
  theme_minimal()

ggsave(filename = paste0(plots, "prominence_duration.png"), plot = last_plot(), width = 6, height = 4)

3.2.2 Duration without silences

What is the average duration of sounding across the different prosodic prominence ratings in Catalan vs in German?

targets %>% 
  group_by(language, percProm) %>%
  summarize(avg_duration_noSilence = mean(duration_noSilence, na.rm = TRUE))

Let’s plot it.

ggplot(targets %>% filter(!is.na(percProm)), aes(x = language, y = duration_noSilence, fill = as.factor(percProm))) +
  geom_violin(scale = "width", trim = FALSE, alpha = 0.3) +
  geom_boxplot(width = 0.1, outlier.shape = NA, position = position_dodge(width = 0.9), alpha = 0.5) +
  labs(
    #title = "Duration of Prosodic Prominence Ratings by Language",
    x = "Language",
    y = "Duration (without silences)",
    fill = "Prosodic prominence"
  ) +
  scale_fill_manual(values = colorBlindBlack8) +
  theme_minimal()

ggsave(filename = paste0(plots, "prominence_duration_noSilence.png"), plot = last_plot(), width = 6, height = 4)

3.2.3 Amplitude (median)

What is the average amplitude (median) across the different prosodic prominence ratings in Catalan vs in German?

targets %>% 
  group_by(language, percProm) %>%
  summarize(avg_ampl_median = mean(ampl_median, na.rm = TRUE))

Let’s plot it.

ggplot(targets %>% filter(!is.na(percProm)), aes(x = language, y = ampl_median, fill = as.factor(percProm))) +
  geom_violin(scale = "width", trim = FALSE, alpha = 0.3) +
  geom_boxplot(width = 0.1, outlier.shape = NA, position = position_dodge(width = 0.9), alpha = 0.5) +
  labs(
    #title = "Duration of Prosodic Prominence Ratings by Language",
    x = "Language",
    y = "Amplitude (medians)",
    fill = "Prosodic prominence"
  ) +
  scale_fill_manual(values = colorBlindBlack8) +
  theme_minimal()

ggsave(filename = paste0(plots, "prominence_ampl_median.png"), plot = last_plot(), width = 6, height = 4)

3.2.4 Amplitude (sd)

What is the average amplitude (sd) across the different prosodic prominence ratings in Catalan vs in German?

targets %>% 
  group_by(language, percProm) %>%
  summarize(avg_ampl_median = mean(ampl_sd, na.rm = TRUE))

Let’s plot it.

ggplot(targets %>% filter(!is.na(percProm)), aes(x = language, y = ampl_sd, fill = as.factor(percProm))) +
  geom_violin(scale = "width", trim = FALSE, alpha = 0.3) +
  geom_boxplot(width = 0.1, outlier.shape = NA, position = position_dodge(width = 0.9), alpha = 0.5) +
  labs(
    #title = "Duration of Prosodic Prominence Ratings by Language",
    x = "Language",
    y = "Amplitude (sd)",
    fill = "Prosodic prominence"
  ) +
  scale_fill_manual(values = colorBlindBlack8) +
  theme_minimal()

ggsave(filename = paste0(plots, "prominence_ampl_sd.png"), plot = last_plot(), width = 6, height = 4)

3.2.5 Amplitude (median) without silences

What is the average amplitude (median) without silences across the different prosodic prominence ratings in Catalan vs in German?

targets %>% 
  group_by(language, percProm) %>%
  summarize(avg_ampl_noSilence_median = mean(ampl_noSilence_median, na.rm = TRUE))

Let’s plot it.

ggplot(targets %>% filter(!is.na(percProm)), aes(x = language, y = ampl_noSilence_median, fill = as.factor(percProm))) +
  geom_violin(scale = "width", trim = FALSE, alpha = 0.3) +
  geom_boxplot(width = 0.1, outlier.shape = NA, position = position_dodge(width = 0.9), alpha = 0.5) +
  labs(
    #title = "Duration of Prosodic Prominence Ratings by Language",
    x = "Language",
    y = "Amplitude without silences (medians)",
    fill = "Prosodic prominence"
  ) +
  scale_fill_manual(values = colorBlindBlack8) +
  theme_minimal()

ggsave(filename = paste0(plots, "prominence_ampl_noSilence_median.png"), plot = last_plot(), width = 6, height = 4)

3.2.6 Amplitude (sd) without silences

What is the average amplitude (sd) without silences across the different prosodic prominence ratings in Catalan vs in German?

targets %>% 
  group_by(language, percProm) %>%
  summarize(avg_ampl_noSilence_median = mean(ampl_noSilence_sd, na.rm = TRUE))

Let’s plot it.

ggplot(targets %>% filter(!is.na(percProm)), aes(x = language, y = ampl_noSilence_sd, fill = as.factor(percProm))) +
  geom_violin(scale = "width", trim = FALSE, alpha = 0.3) +
  geom_boxplot(width = 0.1, outlier.shape = NA, position = position_dodge(width = 0.9), alpha = 0.5) +
  labs(
    #title = "Duration of Prosodic Prominence Ratings by Language",
    x = "Language",
    y = "Amplitude without silences (sd)",
    fill = "Prosodic prominence"
  ) +
  scale_fill_manual(values = colorBlindBlack8) +
  theme_minimal()

ggsave(filename = paste0(plots, "prominence_ampl_noSilence_sd.png"), plot = last_plot(), width = 6, height = 4)

3.2.7 Amplitude envelope slope

What is the average amplitude envelope slope across the different prosodic prominence ratings in Catalan vs in German?

targets %>% 
  group_by(language, percProm) %>%
  summarize(avg_env_slope = mean(env_slope, na.rm = TRUE))

Let’s plot it.

ggplot(targets %>% filter(!is.na(percProm)), aes(x = language, y = env_slope, fill = as.factor(percProm))) +
  geom_violin(scale = "width", trim = FALSE, alpha = 0.3) +
  geom_boxplot(width = 0.1, outlier.shape = NA, position = position_dodge(width = 0.9), alpha = 0.5) +
  labs(
    #title = "Duration of Prosodic Prominence Ratings by Language",
    x = "Language",
    y = "Amplitude envelope slope",
    fill = "Prosodic prominence"
  ) +
  scale_fill_manual(values = colorBlindBlack8) +
  theme_minimal()

ggsave(filename = paste0(plots, "prominence_env_slope.png"), plot = last_plot(), width = 6, height = 4)

3.2.8 Pitch (median)

What is the average pitch (median) across the different prosodic prominence ratings in Catalan vs in German?

# Raw
targets %>% 
  group_by(language, percProm) %>%
  summarize(avg_pitch_median = mean(pitch_median, na.rm = TRUE))
# Normalized
targets %>% 
  group_by(language, percProm) %>%
  summarize(avg_pitch_median = mean(pitch_median_norm, na.rm = TRUE))

Let’s plot it.

# Raw
ggplot(targets %>% filter(!is.na(percProm)), aes(x = language, y = pitch_median, fill = as.factor(percProm))) +
  geom_violin(scale = "width", trim = FALSE, alpha = 0.3) +
  geom_boxplot(width = 0.1, outlier.shape = NA, position = position_dodge(width = 0.9), alpha = 0.5) +
  labs(
    #title = "Duration of Prosodic Prominence Ratings by Language",
    x = "Language",
    y = "f0 (raw medians)",
    fill = "Prosodic prominence"
  ) +
  scale_fill_manual(values = colorBlindBlack8) +
  theme_minimal()

ggsave(filename = paste0(plots, "prominence_pitch_median_raw.png"), plot = last_plot(), width = 6, height = 4)

# Normalized
ggplot(targets %>% filter(!is.na(percProm)), aes(x = language, y = pitch_median_norm, fill = as.factor(percProm))) +
  geom_violin(scale = "width", trim = FALSE, alpha = 0.3) +
  geom_boxplot(width = 0.1, outlier.shape = NA, position = position_dodge(width = 0.9), alpha = 0.5) +
  labs(
    #title = "Duration of Prosodic Prominence Ratings by Language",
    x = "Language",
    y = "f0 (normalized medians)",
    fill = "Prosodic prominence"
  ) +
  scale_fill_manual(values = colorBlindBlack8) +
  theme_minimal()

ggsave(filename = paste0(plots, "prominence_pitch_median_norm.png"), plot = last_plot(), width = 6, height = 4)

3.2.9 Pitch (sd)

What is the average pitch (sd) across the different prosodic prominence ratings in Catalan vs in German?

# Raw
targets %>% 
  group_by(language, percProm) %>%
  summarize(avg_pitch_sd = mean(pitch_sd, na.rm = TRUE))
# Normalized
targets %>% 
  group_by(language, percProm) %>%
  summarize(avg_pitch_sd = mean(pitch_sd_norm, na.rm = TRUE))

Let’s plot it.

# Raw
ggplot(targets %>% filter(!is.na(percProm)), aes(x = language, y = pitch_sd, fill = as.factor(percProm))) +
  geom_violin(scale = "width", trim = FALSE, alpha = 0.3) +
  geom_boxplot(width = 0.1, outlier.shape = NA, position = position_dodge(width = 0.9), alpha = 0.5) +
  labs(
    #title = "Duration of Prosodic Prominence Ratings by Language",
    x = "Language",
    y = "f0 (raw sd)",
    fill = "Prosodic prominence"
  ) +
  scale_fill_manual(values = colorBlindBlack8) +
  theme_minimal()

ggsave(filename = paste0(plots, "prominence_pitch_sd_raw.png"), plot = last_plot(), width = 6, height = 4)

# Normalized
ggplot(targets %>% filter(!is.na(percProm)), aes(x = language, y = pitch_sd_norm, fill = as.factor(percProm))) +
  geom_violin(scale = "width", trim = FALSE, alpha = 0.3) +
  geom_boxplot(width = 0.1, outlier.shape = NA, position = position_dodge(width = 0.9), alpha = 0.5) +
  labs(
    #title = "Duration of Prosodic Prominence Ratings by Language",
    x = "Language",
    y = "f0 (normalized sd)",
    fill = "Prosodic prominence"
  ) +
  scale_fill_manual(values = colorBlindBlack8) +
  theme_minimal()

ggsave(filename = paste0(plots, "prominence_pitch_sd_norm.png"), plot = last_plot(), width = 6, height = 4)

3.2.10 F0 slope

What is the average f0 slope across the different prosodic prominence ratings in Catalan vs in German?

# Raw
targets %>% 
  group_by(language, percProm) %>%
  summarize(avg_f0_slope = mean(f0_slope, na.rm = TRUE))
# Normalized
targets %>% 
  group_by(language, percProm) %>%
  summarize(avg_f0_slope = mean(f0_slope_norm, na.rm = TRUE))

Let’s plot it.

# Raw
ggplot(targets %>% filter(!is.na(percProm)), aes(x = language, y = f0_slope, fill = as.factor(percProm))) +
  geom_violin(scale = "width", trim = FALSE, alpha = 0.3) +
  geom_boxplot(width = 0.1, outlier.shape = NA, position = position_dodge(width = 0.9), alpha = 0.5) +
  labs(
    #title = "Duration of Prosodic Prominence Ratings by Language",
    x = "Language",
    y = "f0 slope (raw)",
    fill = "Prosodic prominence"
  ) +
  scale_fill_manual(values = colorBlindBlack8) +
  theme_minimal()

ggsave(filename = paste0(plots, "prominence_f0_slope_raw.png"), plot = last_plot(), width = 6, height = 4)

# Normalized
ggplot(targets %>% filter(!is.na(percProm)), aes(x = language, y = f0_slope_norm, fill = as.factor(percProm))) +
  geom_violin(scale = "width", trim = FALSE, alpha = 0.3) +
  geom_boxplot(width = 0.1, outlier.shape = NA, position = position_dodge(width = 0.9), alpha = 0.5) +
  labs(
    #title = "Duration of Prosodic Prominence Ratings by Language",
    x = "Language",
    y = "f0 slope (normalized)",
    fill = "Prosodic prominence"
  ) +
  scale_fill_manual(values = colorBlindBlack8) +
  theme_minimal()

ggsave(filename = paste0(plots, "prominence_f0_slope_norm.png"), plot = last_plot(), width = 6, height = 4)

3.2.11 F1 (median)

What is the average f1 (median) across the different prosodic prominence ratings in Catalan vs in German?

# Raw
targets %>% 
  group_by(language, percProm) %>%
  summarize(avg_f1_freq_median = mean(f1_freq_median, na.rm = TRUE))
# Normalized
targets %>% 
  group_by(language, percProm) %>%
  summarize(avg_f1_freq_median = mean(f1_freq_median_norm, na.rm = TRUE))

Let’s plot it.

# Raw
ggplot(targets %>% filter(!is.na(percProm)), aes(x = language, y = f1_freq_median, fill = as.factor(percProm))) +
  geom_violin(scale = "width", trim = FALSE, alpha = 0.3) +
  geom_boxplot(width = 0.1, outlier.shape = NA, position = position_dodge(width = 0.9), alpha = 0.5) +
  labs(
    #title = "Duration of Prosodic Prominence Ratings by Language",
    x = "Language",
    y = "f1 (raw medians)",
    fill = "Prosodic prominence"
  ) +
  scale_fill_manual(values = colorBlindBlack8) +
  theme_minimal()

ggsave(filename = paste0(plots, "prominence_f1_freq_median_raw.png"), plot = last_plot(), width = 6, height = 4)

# Normalized
ggplot(targets %>% filter(!is.na(percProm)), aes(x = language, y = f1_freq_median_norm, fill = as.factor(percProm))) +
  geom_violin(scale = "width", trim = FALSE, alpha = 0.3) +
  geom_boxplot(width = 0.1, outlier.shape = NA, position = position_dodge(width = 0.9), alpha = 0.5) +
  labs(
    #title = "Duration of Prosodic Prominence Ratings by Language",
    x = "Language",
    y = "f1 (normalized medians)",
    fill = "Prosodic prominence"
  ) +
  scale_fill_manual(values = colorBlindBlack8) +
  theme_minimal()

ggsave(filename = paste0(plots, "prominence_f1_freq_median_norm.png"), plot = last_plot(), width = 6, height = 4)

We will not use f1 because we cannot be sure that the distribution of vowels is even across perceived prominence ratings.

3.2.12 F2 (median)

What is the average f2 (median) across the different prosodic prominence ratings in Catalan vs in German?

# Raw
targets %>% 
  group_by(language, percProm) %>%
  summarize(avg_f2_freq_median = mean(f2_freq_median, na.rm = TRUE))
# Normalized
targets %>% 
  group_by(language, percProm) %>%
  summarize(avg_f2_freq_median = mean(f2_freq_median_norm, na.rm = TRUE))

Let’s plot it.

# Raw
ggplot(targets %>% filter(!is.na(percProm)), aes(x = language, y = f2_freq_median, fill = as.factor(percProm))) +
  geom_violin(scale = "width", trim = FALSE, alpha = 0.3) +
  geom_boxplot(width = 0.1, outlier.shape = NA, position = position_dodge(width = 0.9), alpha = 0.5) +
  labs(
    #title = "Duration of Prosodic Prominence Ratings by Language",
    x = "Language",
    y = "f2 (raw medians)",
    fill = "Prosodic prominence"
  ) +
  scale_fill_manual(values = colorBlindBlack8) +
  theme_minimal()

ggsave(filename = paste0(plots, "prominence_f2_freq_median_raw.png"), plot = last_plot(), width = 6, height = 4)

# Normalized
ggplot(targets %>% filter(!is.na(percProm)), aes(x = language, y = f2_freq_median_norm, fill = as.factor(percProm))) +
  geom_violin(scale = "width", trim = FALSE, alpha = 0.3) +
  geom_boxplot(width = 0.1, outlier.shape = NA, position = position_dodge(width = 0.9), alpha = 0.5) +
  labs(
    #title = "Duration of Prosodic Prominence Ratings by Language",
    x = "Language",
    y = "f2 (normalized medians)",
    fill = "Prosodic prominence"
  ) +
  scale_fill_manual(values = colorBlindBlack8) +
  theme_minimal()

ggsave(filename = paste0(plots, "prominence_f2_freq_median_norm.png"), plot = last_plot(), width = 6, height = 4)

We will not use f2 because we cannot be sure that the distribution of vowels is even across perceived prominence ratings.

3.2.13 CPP (median)

What is the average CPP (median) across the different prosodic prominence ratings in Catalan vs in German?

targets %>% 
  group_by(language, percProm) %>%
  summarize(avg_CPP_median = mean(CPP_median, na.rm = TRUE))

Let’s plot it.

ggplot(targets %>% filter(!is.na(percProm)), aes(x = language, y = CPP_median, fill = as.factor(percProm))) +
  geom_violin(scale = "width", trim = FALSE, alpha = 0.3) +
  geom_boxplot(width = 0.1, outlier.shape = NA, position = position_dodge(width = 0.9), alpha = 0.5) +
  labs(
    #title = "Duration of Prosodic Prominence Ratings by Language",
    x = "Language",
    y = "CPP (medians)",
    fill = "Prosodic prominence"
  ) +
  scale_fill_manual(values = colorBlindBlack8) +
  theme_minimal()

ggsave(filename = paste0(plots, "prominence_CPP_median.png"), plot = last_plot(), width = 6, height = 4)

3.2.14 CPP (sd)

What is the average CPP (sd) across the different prosodic prominence ratings in Catalan vs in German?

targets %>% 
  group_by(language, percProm) %>%
  summarize(avg_CPP_sd = mean(CPP_sd, na.rm = TRUE))

Let’s plot it.

ggplot(targets %>% filter(!is.na(percProm)), aes(x = language, y = CPP_sd, fill = as.factor(percProm))) +
  geom_violin(scale = "width", trim = FALSE, alpha = 0.3) +
  geom_boxplot(width = 0.1, outlier.shape = NA, position = position_dodge(width = 0.9), alpha = 0.5) +
  labs(
    #title = "Duration of Prosodic Prominence Ratings by Language",
    x = "Language",
    y = "CPP (sd)",
    fill = "Prosodic prominence"
  ) +
  scale_fill_manual(values = colorBlindBlack8) +
  theme_minimal()

ggsave(filename = paste0(plots, "prominence_CPP_sd.png"), plot = last_plot(), width = 6, height = 4)

3.2.15 Flux (median)

What is the average flux (median) across the different prosodic prominence ratings in Catalan vs in German?

targets %>% 
  group_by(language, percProm) %>%
  summarize(avg_flux_median = mean(flux_median, na.rm = TRUE))

Let’s plot it.

ggplot(targets %>% filter(!is.na(percProm)), aes(x = language, y = flux_median, fill = as.factor(percProm))) +
  geom_violin(scale = "width", trim = FALSE, alpha = 0.3) +
  geom_boxplot(width = 0.1, outlier.shape = NA, position = position_dodge(width = 0.9), alpha = 0.5) +
  labs(
    #title = "Duration of Prosodic Prominence Ratings by Language",
    x = "Language",
    y = "Flux (medians)",
    fill = "Prosodic prominence"
  ) +
  scale_fill_manual(values = colorBlindBlack8) +
  ylim(0, 0.1) + # Because of outliers, especially in Catalan
  theme_minimal()

ggsave(filename = paste0(plots, "prominence_flux_median.png"), plot = last_plot(), width = 6, height = 4)

3.2.16 Flux (sd)

What is the average flux (sd) across the different prosodic prominence ratings in Catalan vs in German?

targets %>% 
  group_by(language, percProm) %>%
  summarize(avg_flux_sd = mean(flux_sd, na.rm = TRUE))

Let’s plot it.

ggplot(targets %>% filter(!is.na(percProm)), aes(x = language, y = flux_sd, fill = as.factor(percProm))) +
  geom_violin(scale = "width", trim = FALSE, alpha = 0.3) +
  geom_boxplot(width = 0.1, outlier.shape = NA, position = position_dodge(width = 0.9), alpha = 0.5) +
  labs(
    #title = "Duration of Prosodic Prominence Ratings by Language",
    x = "Language",
    y = "Flux (sd)",
    fill = "Prosodic prominence"
  ) +
  scale_fill_manual(values = colorBlindBlack8) +
  theme_minimal()

ggsave(filename = paste0(plots, "prominence_flux_sd.png"), plot = last_plot(), width = 6, height = 4)

3.2.17 Novelty (median)

What is the average novelty (median) across the different prosodic prominence ratings in Catalan vs in German?

targets %>% 
  group_by(language, percProm) %>%
  summarize(avg_novelty_median = mean(novelty_median, na.rm = TRUE))

Let’s plot it.

ggplot(targets %>% filter(!is.na(percProm)), aes(x = language, y = novelty_median, fill = as.factor(percProm))) +
  geom_violin(scale = "width", trim = FALSE, alpha = 0.3) +
  geom_boxplot(width = 0.1, outlier.shape = NA, position = position_dodge(width = 0.9), alpha = 0.5) +
  labs(
    #title = "Duration of Prosodic Prominence Ratings by Language",
    x = "Language",
    y = "Novelty (medians)",
    fill = "Prosodic prominence"
  ) +
  scale_fill_manual(values = colorBlindBlack8) +
  theme_minimal()

ggsave(filename = paste0(plots, "prominence_novelty_median.pdf"), plot = last_plot(), width = 6, height = 4)

3.2.18 Novelty (sd)

What is the average novelty (sd) across the different prosodic prominence ratings in Catalan vs in German?

targets %>% 
  group_by(language, percProm) %>%
  summarize(avg_novelty_sd = mean(novelty_sd, na.rm = TRUE))

Let’s plot it.

ggplot(targets %>% filter(!is.na(percProm)), aes(x = language, y = novelty_sd, fill = as.factor(percProm))) +
  geom_violin(scale = "width", trim = FALSE, alpha = 0.3) +
  geom_boxplot(width = 0.1, outlier.shape = NA, position = position_dodge(width = 0.9), alpha = 0.5) +
  labs(
    #title = "Duration of Prosodic Prominence Ratings by Language",
    x = "Language",
    y = "Novelty (sd)",
    fill = "Prosodic prominence"
  ) +
  scale_fill_manual(values = colorBlindBlack8) +
  theme_minimal()

ggsave(filename = paste0(plots, "prominence_novelty_sd.png"), plot = last_plot(), width = 6, height = 4)

3.2.19 Spectral centroid (median)

What is the average spectral centroid (median) across the different prosodic prominence ratings in Catalan vs in German?

targets %>% 
  group_by(language, percProm) %>%
  summarize(avg_specCentroid_median = mean(specCentroid_median, na.rm = TRUE))

Let’s plot it.

ggplot(targets %>% filter(!is.na(percProm)), aes(x = language, y = specCentroid_median, fill = as.factor(percProm))) +
  geom_violin(scale = "width", trim = FALSE, alpha = 0.3) +
  geom_boxplot(width = 0.1, outlier.shape = NA, position = position_dodge(width = 0.9), alpha = 0.5) +
  labs(
    #title = "Duration of Prosodic Prominence Ratings by Language",
    x = "Language",
    y = "Spectral centroid (medians)",
    fill = "Prosodic prominence"
  ) +
  scale_fill_manual(values = colorBlindBlack8) +
  theme_minimal()

ggsave(filename = paste0(plots, "prominence_specCentroid_median.png"), plot = last_plot(), width = 6, height = 4)

3.2.20 Spectral centroid (sd)

What is the average spectral centroid (sd) across the different prosodic prominence ratings in Catalan vs in German?

targets %>% 
  group_by(language, percProm) %>%
  summarize(avg_specCentroid_sd = mean(specCentroid_sd, na.rm = TRUE))

Let’s plot it.

ggplot(targets %>% filter(!is.na(percProm)), aes(x = language, y = specCentroid_sd, fill = as.factor(percProm))) +
  geom_violin(scale = "width", trim = FALSE, alpha = 0.3) +
  geom_boxplot(width = 0.1, outlier.shape = NA, position = position_dodge(width = 0.9), alpha = 0.5) +
  labs(
    #title = "Duration of Prosodic Prominence Ratings by Language",
    x = "Language",
    y = "Spectral centroid (sd)",
    fill = "Prosodic prominence"
  ) +
  scale_fill_manual(values = colorBlindBlack8) +
  theme_minimal()

ggsave(filename = paste0(plots, "prominence_specCentroid_sd.png"), plot = last_plot(), width = 6, height = 4)

3.2.21 Weiner entropy (median)

What is the average Weiner entropy (median) across the different prosodic prominence ratings in Catalan vs in German?

targets %>% 
  group_by(language, percProm) %>%
  summarize(avg_entropy_median = mean(entropy_median, na.rm = TRUE))

Let’s plot it.

ggplot(targets %>% filter(!is.na(percProm)), aes(x = language, y = entropy_median, fill = as.factor(percProm))) +
  geom_violin(scale = "width", trim = FALSE, alpha = 0.3) +
  geom_boxplot(width = 0.1, outlier.shape = NA, position = position_dodge(width = 0.9), alpha = 0.5) +
  labs(
    #title = "Duration of Prosodic Prominence Ratings by Language",
    x = "Language",
    y = "Weiner Entropy (medians)",
    fill = "Prosodic prominence"
  ) +
  scale_fill_manual(values = colorBlindBlack8) +
  theme_minimal()

ggsave(filename = paste0(plots, "prominence_entropy_median.png"), plot = last_plot(), width = 6, height = 4)

3.2.22 Weiner entropy (sd)

What is the average Weiner entropy (sd) across the different prosodic prominence ratings in Catalan vs in German?

targets %>% 
  group_by(language, percProm) %>%
  summarize(avg_entropy_sd = mean(entropy_sd, na.rm = TRUE))

Let’s plot it.

ggplot(targets %>% filter(!is.na(percProm)), aes(x = language, y = entropy_sd, fill = as.factor(percProm))) +
  geom_violin(scale = "width", trim = FALSE, alpha = 0.3) +
  geom_boxplot(width = 0.1, outlier.shape = NA, position = position_dodge(width = 0.9), alpha = 0.5) +
  labs(
    #title = "Duration of Prosodic Prominence Ratings by Language",
    x = "Language",
    y = "Weiner Entropy (sd)",
    fill = "Prosodic prominence"
  ) +
  scale_fill_manual(values = colorBlindBlack8) +
  theme_minimal()

ggsave(filename = paste0(plots, "prominence_entropy_sd.png"), plot = last_plot(), width = 6, height = 4)

3.2.23 Shannon entropy (median)

What is the average Shannon entropySh (median) across the different prosodic prominence ratings in Catalan vs in German?

targets %>% 
  group_by(language, percProm) %>%
  summarize(avg_entropySh_median = mean(entropySh_median, na.rm = TRUE))

Let’s plot it.

ggplot(targets %>% filter(!is.na(percProm)), aes(x = language, y = entropySh_median, fill = as.factor(percProm))) +
  geom_violin(scale = "width", trim = FALSE, alpha = 0.3) +
  geom_boxplot(width = 0.1, outlier.shape = NA, position = position_dodge(width = 0.9), alpha = 0.5) +
  labs(
    #title = "Duration of Prosodic Prominence Ratings by Language",
    x = "Language",
    y = "Shannon Entropy (medians)",
    fill = "Prosodic prominence"
  ) +
  scale_fill_manual(values = colorBlindBlack8) +
  theme_minimal()

ggsave(filename = paste0(plots, "prominence_entropySh_median.png"), plot = last_plot(), width = 6, height = 4)

3.2.24 Shannon entropy (sd)

What is the average Shannon entropySh (sd) across the different prosodic prominence ratings in Catalan vs in German?

targets %>% 
  group_by(language, percProm) %>%
  summarize(avg_entropySh_sd = mean(entropySh_sd, na.rm = TRUE))

Let’s plot it.

ggplot(targets %>% filter(!is.na(percProm)), aes(x = language, y = entropySh_sd, fill = as.factor(percProm))) +
  geom_violin(scale = "width", trim = FALSE, alpha = 0.3) +
  geom_boxplot(width = 0.1, outlier.shape = NA, position = position_dodge(width = 0.9), alpha = 0.5) +
  labs(
    #title = "Duration of Prosodic Prominence Ratings by Language",
    x = "Language",
    y = "Shannon Entropy (sd)",
    fill = "Prosodic prominence"
  ) +
  scale_fill_manual(values = colorBlindBlack8) +
  theme_minimal()

ggsave(filename = paste0(plots, "prominence_entropySh_sd.png"), plot = last_plot(), width = 6, height = 4)

3.2.25 Harmonics-to-Noise Ratio (median)

What is the average Harmonics-to-Noise Ratio (median) across the different prosodic prominence ratings in Catalan vs in German?

targets %>% 
  group_by(language, percProm) %>%
  summarize(avg_HNR_median = mean(HNR_median, na.rm = TRUE))

Let’s plot it.

ggplot(targets %>% filter(!is.na(percProm)), aes(x = language, y = HNR_median, fill = as.factor(percProm))) +
  geom_violin(scale = "width", trim = FALSE, alpha = 0.3) +
  geom_boxplot(width = 0.1, outlier.shape = NA, position = position_dodge(width = 0.9), alpha = 0.5) +
  labs(
    #title = "Duration of Prosodic Prominence Ratings by Language",
    x = "Language",
    y = "HNR (medians)",
    fill = "Prosodic prominence"
  ) +
  scale_fill_manual(values = colorBlindBlack8) +
  theme_minimal()

ggsave(filename = paste0(plots, "prominence_HNR_median.png"), plot = last_plot(), width = 6, height = 4)

3.2.26 Harmonics-to-Noise Ratio (sd)

What is the average Harmonics-to-Noise Ratio (sd) across the different prosodic prominence ratings in Catalan vs in German?

targets %>% 
  group_by(language, percProm) %>%
  summarize(avg_HNR_sd = mean(HNR_sd, na.rm = TRUE))

Let’s plot it.

ggplot(targets %>% filter(!is.na(percProm)), aes(x = language, y = HNR_sd, fill = as.factor(percProm))) +
  geom_violin(scale = "width", trim = FALSE, alpha = 0.3) +
  geom_boxplot(width = 0.1, outlier.shape = NA, position = position_dodge(width = 0.9), alpha = 0.5) +
  labs(
    #title = "Duration of Prosodic Prominence Ratings by Language",
    x = "Language",
    y = "HNR (sd)",
    fill = "Prosodic prominence"
  ) +
  scale_fill_manual(values = colorBlindBlack8) +
  theme_minimal()

ggsave(filename = paste0(plots, "prominence_HNR_sd.png"), plot = last_plot(), width = 6, height = 4)

3.2.27 Amplitude modulation (median)

What is the average amplitude modulation (median) across the different prosodic prominence ratings in Catalan vs in German?

targets %>% 
  group_by(language, percProm) %>%
  summarize(avg_amEnvDep_median = mean(amEnvDep_median, na.rm = TRUE))

Let’s plot it.

ggplot(targets %>% filter(!is.na(percProm)), aes(x = language, y = amEnvDep_median, fill = as.factor(percProm))) +
  geom_violin(scale = "width", trim = FALSE, alpha = 0.3) +
  geom_boxplot(width = 0.1, outlier.shape = NA, position = position_dodge(width = 0.9), alpha = 0.5) +
  labs(
    #title = "Duration of Prosodic Prominence Ratings by Language",
    x = "Language",
    y = "Amplitude modulation (medians)",
    fill = "Prosodic prominence"
  ) +
  scale_fill_manual(values = colorBlindBlack8) +
  theme_minimal()

ggsave(filename = paste0(plots, "prominence_amEnvDep_median.png"), plot = last_plot(), width = 6, height = 4)

3.2.28 Amplitude modulation (sd)

What is the average amplitude modulation (sd) across the different prosodic prominence ratings in Catalan vs in German?

targets %>% 
  group_by(language, percProm) %>%
  summarize(avg_amEnvDep_sd = mean(amEnvDep_sd, na.rm = TRUE))

Let’s plot it.

ggplot(targets %>% filter(!is.na(percProm)), aes(x = language, y = amEnvDep_sd, fill = as.factor(percProm))) +
  geom_violin(scale = "width", trim = FALSE, alpha = 0.3) +
  geom_boxplot(width = 0.1, outlier.shape = NA, position = position_dodge(width = 0.9), alpha = 0.5) +
  labs(
    #title = "Duration of Prosodic Prominence Ratings by Language",
    x = "Language",
    y = "Amplitude modulation (sd)",
    fill = "Prosodic prominence"
  ) +
  scale_fill_manual(values = colorBlindBlack8) +
  theme_minimal()

ggsave(filename = paste0(plots, "prominence_amEnvDep_sd.png"), plot = last_plot(), width = 6, height = 4)

3.2.29 Frequency modulation (median)

What is the average frequency modulation (median) across the different prosodic prominence ratings in Catalan vs in German?

targets %>% 
  group_by(language, percProm) %>%
  summarize(avg_fmDep_median = mean(fmDep_median, na.rm = TRUE))

Let’s plot it.

ggplot(targets %>% filter(!is.na(percProm)), aes(x = language, y = fmDep_median, fill = as.factor(percProm))) +
  geom_violin(scale = "width", trim = FALSE, alpha = 0.3) +
  geom_boxplot(width = 0.1, outlier.shape = NA, position = position_dodge(width = 0.9), alpha = 0.5) +
  labs(
    #title = "Duration of Prosodic Prominence Ratings by Language",
    x = "Language",
    y = "Frequency modulation (medians)",
    fill = "Prosodic prominence"
  ) +
  scale_fill_manual(values = colorBlindBlack8) +
  theme_minimal()

ggsave(filename = paste0(plots, "prominence_fmDep_median.png"), plot = last_plot(), width = 6, height = 4)

3.2.30 Frequency modulation (sd)

What is the average frequency modulation (sd) across the different prosodic prominence ratings in Catalan vs in German?

targets %>% 
  group_by(language, percProm) %>%
  summarize(avg_fmDep_sd = mean(fmDep_sd, na.rm = TRUE))

Let’s plot it.

ggplot(targets %>% filter(!is.na(percProm)), aes(x = language, y = fmDep_sd, fill = as.factor(percProm))) +
  geom_violin(scale = "width", trim = FALSE, alpha = 0.3) +
  geom_boxplot(width = 0.1, outlier.shape = NA, position = position_dodge(width = 0.9), alpha = 0.5) +
  labs(
    #title = "Duration of Prosodic Prominence Ratings by Language",
    x = "Language",
    y = "Frequency modulation (sd)",
    fill = "Prosodic prominence"
  ) +
  scale_fill_manual(values = colorBlindBlack8) +
  ylim(-0.1, 0.5) + # because of outliers
  theme_minimal()

ggsave(filename = paste0(plots, "prominence_fmDep_sd.png"), plot = last_plot(), width = 6, height = 4)

3.3 Pre- and posttonic

Prepare data frame.

data_long <- data_prepost %>%
  select(fileName, language, itemType, focus, annotationNum,
         starts_with("pitch_"), 
         starts_with("env_"), 
         starts_with("duration"),
         starts_with("ampl_"), 
         starts_with("f0_"), 
         starts_with("f1_freq_"),
         starts_with("f2_freq_"), 
         starts_with("CPP_"),
         starts_with("flux_"),
         starts_with("novelty_"),
         starts_with("specCentroid_"), 
         starts_with("entropy_"), 
         starts_with("entropySh_"),
         starts_with("HNR_"), 
         starts_with("amEnvDep_"),
         starts_with("fmDep_")) %>%
  pivot_longer(cols = -c(fileName, language, itemType, focus, annotationNum),
               names_to = "variable",
               values_to = "value") %>%
  mutate(
    phase = case_when(
      grepl("Pre$", variable) ~ "pre",
      grepl("Post$", variable) ~ "post",
      TRUE ~ "target"
    ),
    # Remove suffixes from variable names for a cleaner look
    variable = gsub("Pre|Post", "", variable)
  )

# Correct the phase factor levels
data_long$phase <- factor(data_long$phase, levels = c("pre", "target", "post"))

3.3.1 Variable x Language plots

# Get unique languages and variables
languages <- unique(data_long$language)
variables <- unique(data_long$variable)

# Without lines
for (var in variables) {
  for (lang in languages) {
    # Filter data_long for the current language and variable
    data_filtered <- subset(data_long, variable == var & language == lang)
    
    # Generate the plot for the current language and variable
    p <- ggplot(data = data_filtered, aes(x = phase, y = value, fill = phase)) +
      geom_violin(scale = "width", trim = FALSE, alpha = 0.3) +
      geom_boxplot(width = 0.1, outlier.shape = NA, position = position_dodge(width = 0.9), alpha = 0.5) +
      scale_fill_manual(values = colorBlindBlack8) +
      labs(x = "Syllable",
           y = var,
           title = lang) +
      theme_minimal() +
      theme(legend.position = "none")
    
    # Dynamically generate the file name to include both language and variable
    file_name <- paste0(plots, "/prepost_", var, "_", lang, ".png")
    
    # Save the plot
    ggsave(filename = file_name, plot = p, width = 10, height = 8)
  }
}

# With lines
for (var in variables) {
  for (lang in languages) {
    # Filter data_long for the current language and variable
    data_filtered <- subset(data_long, variable == var & language == lang)
    
    # Generate the plot for the current language and variable
    p <- ggplot(data = data_filtered, aes(x = phase, y = value, fill = phase)) +
      geom_violin(scale = "width", trim = FALSE, alpha = 0.3) +
      geom_boxplot(width = 0.1, outlier.shape = NA, position = position_dodge(width = 0.9), alpha = 0.5) +
      geom_line(aes(group = interaction(fileName, annotationNum)), color = "grey", alpha = 0.1) +
      scale_fill_manual(values = colorBlindBlack8) +
      labs(x = "Syllable",
           y = var,
           title = lang) +
      theme_minimal() +
      theme(legend.position = "none")
    
    # Dynamically generate the file name to include both language and variable
    file_name <- paste0(plots, "/prepost_", var, "_lines_", lang, ".png")
    
    # Save the plot
    ggsave(filename = file_name, plot = p, width = 10, height = 8)
  }
}

# Clean up the environment
rm(languages, lang, variables, var, data_filtered)

3.3.2 Variables, Language side-by-side

# Define unique variables for plotting
variables <- unique(data_long$variable)

# Without lines
for (var in variables) {
  # Filter df_long for the current variable
  data_filtered <- subset(data_long, variable == var)
  
  # Generate the plot for the current variable
  p <- ggplot(data = data_filtered, aes(x = phase, y = value, fill = language)) +
    geom_violin(scale = "width", trim = FALSE, alpha = 0.3) +
    geom_boxplot(width = 0.1, outlier.shape = NA, position = position_dodge(width = 0.9), alpha = 0.5) +
    scale_fill_manual(values = colorBlindBlack8) +
    labs(x = "Syllable",
         y = var) +
    theme_minimal()
  
  # Dynamically generate the file name to include the variable
  file_name <- paste0(plots, "prepost_", var, ".png")
  
  # Save the plot
  ggsave(filename = file_name, plot = p, width = 10, height = 8)
}
## Warning: Removed 1986 rows containing non-finite outside the scale range
## (`stat_ydensity()`).
## Warning: Removed 1986 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Warning: Removed 1986 rows containing non-finite outside the scale range
## (`stat_ydensity()`).
## Warning: Removed 1986 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Warning: Removed 1986 rows containing non-finite outside the scale range
## (`stat_ydensity()`).
## Warning: Removed 1986 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Warning: Removed 1986 rows containing non-finite outside the scale range
## (`stat_ydensity()`).
## Warning: Removed 1986 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Warning: Removed 800 rows containing non-finite outside the scale range
## (`stat_ydensity()`).
## Warning: Removed 800 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Warning: Removed 518 rows containing non-finite outside the scale range
## (`stat_ydensity()`).
## Warning: Removed 518 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Warning: Removed 519 rows containing non-finite outside the scale range
## (`stat_ydensity()`).
## Warning: Removed 519 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Warning: Removed 519 rows containing non-finite outside the scale range
## (`stat_ydensity()`).
## Warning: Removed 519 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Warning: Removed 519 rows containing non-finite outside the scale range
## (`stat_ydensity()`).
## Warning: Removed 519 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Warning: Removed 519 rows containing non-finite outside the scale range
## (`stat_ydensity()`).
## Warning: Removed 519 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Warning: Removed 519 rows containing non-finite outside the scale range
## (`stat_ydensity()`).
## Warning: Removed 519 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Warning: Removed 1801 rows containing non-finite outside the scale range
## (`stat_ydensity()`).
## Warning: Removed 1801 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Warning: Removed 1801 rows containing non-finite outside the scale range
## (`stat_ydensity()`).
## Warning: Removed 1801 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Warning: Removed 519 rows containing non-finite outside the scale range
## (`stat_ydensity()`).
## Warning: Removed 519 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Warning: Removed 519 rows containing non-finite outside the scale range
## (`stat_ydensity()`).
## Warning: Removed 519 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Warning: Removed 519 rows containing non-finite outside the scale range
## (`stat_ydensity()`).
## Warning: Removed 519 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Warning: Removed 519 rows containing non-finite outside the scale range
## (`stat_ydensity()`).
## Warning: Removed 519 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Warning: Removed 1986 rows containing non-finite outside the scale range
## (`stat_ydensity()`).
## Warning: Removed 1986 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Warning: Removed 1986 rows containing non-finite outside the scale range
## (`stat_ydensity()`).
## Warning: Removed 1986 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Warning: Removed 519 rows containing non-finite outside the scale range
## (`stat_ydensity()`).
## Warning: Removed 519 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Warning: Removed 522 rows containing non-finite outside the scale range
## (`stat_ydensity()`).
## Warning: Removed 522 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Warning: Removed 519 rows containing non-finite outside the scale range
## (`stat_ydensity()`).
## Warning: Removed 519 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Warning: Removed 519 rows containing non-finite outside the scale range
## (`stat_ydensity()`).
## Warning: Removed 519 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Warning: Removed 519 rows containing non-finite outside the scale range
## (`stat_ydensity()`).
## Warning: Removed 519 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Warning: Removed 519 rows containing non-finite outside the scale range
## (`stat_ydensity()`).
## Warning: Removed 519 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Warning: Removed 519 rows containing non-finite outside the scale range
## (`stat_ydensity()`).
## Warning: Removed 519 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Warning: Removed 519 rows containing non-finite outside the scale range
## (`stat_ydensity()`).
## Warning: Removed 519 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Warning: Removed 519 rows containing non-finite outside the scale range
## (`stat_ydensity()`).
## Warning: Removed 519 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Warning: Removed 519 rows containing non-finite outside the scale range
## (`stat_ydensity()`).
## Warning: Removed 519 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Warning: Removed 1083 rows containing non-finite outside the scale range
## (`stat_ydensity()`).
## Warning: Removed 1083 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Warning: Removed 1520 rows containing non-finite outside the scale range
## (`stat_ydensity()`).
## Warning: Removed 1520 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Warning: Removed 519 rows containing non-finite outside the scale range
## (`stat_ydensity()`).
## Warning: Removed 519 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Warning: Removed 519 rows containing non-finite outside the scale range
## (`stat_ydensity()`).
## Warning: Removed 519 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Warning: Removed 3034 rows containing non-finite outside the scale range
## (`stat_ydensity()`).
## Warning: Removed 3034 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Warning: Removed 3034 rows containing non-finite outside the scale range
## (`stat_ydensity()`).
## Warning: Removed 3034 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
# With lines
for (var in variables) {
  # Filter df_long for the current variable
  data_filtered <- subset(data_long, variable == var)
  
  # Generate the plot for the current variable
  p <- ggplot(data = data_filtered, aes(x = phase, y = value, fill = language)) +
    geom_violin(scale = "width", trim = FALSE, alpha = 0.3) +
    geom_boxplot(width = 0.1, outlier.shape = NA, position = position_dodge(width = 0.9), alpha = 0.5) +
    geom_line(aes(group = interaction(fileName, annotationNum)), color = "grey", alpha = 0.1) +
    scale_fill_manual(values = colorBlindBlack8) +
    labs(x = "Syllable",
         y = var) +
    theme_minimal()
  
  # Dynamically generate the file name to include the variable
  file_name <- paste0(plots, "prepost_", var, "_lines", ".png")
  
  # Save the plot
  ggsave(filename = file_name, plot = p, width = 10, height = 8)
}
## Warning: Removed 1986 rows containing non-finite outside the scale range
## (`stat_ydensity()`).
## Warning: Removed 1986 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Warning: Removed 1916 rows containing missing values or values outside the scale range
## (`geom_line()`).
## Warning: Removed 1986 rows containing non-finite outside the scale range
## (`stat_ydensity()`).
## Warning: Removed 1986 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Warning: Removed 1916 rows containing missing values or values outside the scale range
## (`geom_line()`).
## Warning: Removed 1986 rows containing non-finite outside the scale range
## (`stat_ydensity()`).
## Warning: Removed 1986 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Warning: Removed 1916 rows containing missing values or values outside the scale range
## (`geom_line()`).
## Warning: Removed 1986 rows containing non-finite outside the scale range
## (`stat_ydensity()`).
## Warning: Removed 1986 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Warning: Removed 1916 rows containing missing values or values outside the scale range
## (`geom_line()`).
## Warning: Removed 800 rows containing non-finite outside the scale range
## (`stat_ydensity()`).
## Warning: Removed 800 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Warning: Removed 781 rows containing missing values or values outside the scale range
## (`geom_line()`).
## Warning: Removed 518 rows containing non-finite outside the scale range
## (`stat_ydensity()`).
## Warning: Removed 518 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Warning: Removed 518 rows containing missing values or values outside the scale range
## (`geom_line()`).
## Warning: Removed 519 rows containing non-finite outside the scale range
## (`stat_ydensity()`).
## Warning: Removed 519 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Warning: Removed 518 rows containing missing values or values outside the scale range
## (`geom_line()`).
## Warning: Removed 519 rows containing non-finite outside the scale range
## (`stat_ydensity()`).
## Warning: Removed 519 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Warning: Removed 518 rows containing missing values or values outside the scale range
## (`geom_line()`).
## Warning: Removed 519 rows containing non-finite outside the scale range
## (`stat_ydensity()`).
## Warning: Removed 519 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Warning: Removed 518 rows containing missing values or values outside the scale range
## (`geom_line()`).
## Warning: Removed 519 rows containing non-finite outside the scale range
## (`stat_ydensity()`).
## Warning: Removed 519 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Warning: Removed 518 rows containing missing values or values outside the scale range
## (`geom_line()`).
## Warning: Removed 519 rows containing non-finite outside the scale range
## (`stat_ydensity()`).
## Warning: Removed 519 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Warning: Removed 518 rows containing missing values or values outside the scale range
## (`geom_line()`).
## Warning: Removed 1801 rows containing non-finite outside the scale range
## (`stat_ydensity()`).
## Warning: Removed 1801 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Warning: Removed 1729 rows containing missing values or values outside the scale range
## (`geom_line()`).
## Warning: Removed 1801 rows containing non-finite outside the scale range
## (`stat_ydensity()`).
## Warning: Removed 1801 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Warning: Removed 1729 rows containing missing values or values outside the scale range
## (`geom_line()`).
## Warning: Removed 519 rows containing non-finite outside the scale range
## (`stat_ydensity()`).
## Warning: Removed 519 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Warning: Removed 518 rows containing missing values or values outside the scale range
## (`geom_line()`).
## Warning: Removed 519 rows containing non-finite outside the scale range
## (`stat_ydensity()`).
## Warning: Removed 519 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Warning: Removed 518 rows containing missing values or values outside the scale range
## (`geom_line()`).
## Warning: Removed 519 rows containing non-finite outside the scale range
## (`stat_ydensity()`).
## Warning: Removed 519 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Warning: Removed 518 rows containing missing values or values outside the scale range
## (`geom_line()`).
## Warning: Removed 519 rows containing non-finite outside the scale range
## (`stat_ydensity()`).
## Warning: Removed 519 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Warning: Removed 518 rows containing missing values or values outside the scale range
## (`geom_line()`).
## Warning: Removed 1986 rows containing non-finite outside the scale range
## (`stat_ydensity()`).
## Warning: Removed 1986 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Warning: Removed 1916 rows containing missing values or values outside the scale range
## (`geom_line()`).
## Warning: Removed 1986 rows containing non-finite outside the scale range
## (`stat_ydensity()`).
## Warning: Removed 1986 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Warning: Removed 1916 rows containing missing values or values outside the scale range
## (`geom_line()`).
## Warning: Removed 519 rows containing non-finite outside the scale range
## (`stat_ydensity()`).
## Warning: Removed 519 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Warning: Removed 518 rows containing missing values or values outside the scale range
## (`geom_line()`).
## Warning: Removed 522 rows containing non-finite outside the scale range
## (`stat_ydensity()`).
## Warning: Removed 522 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Warning: Removed 521 rows containing missing values or values outside the scale range
## (`geom_line()`).
## Warning: Removed 519 rows containing non-finite outside the scale range
## (`stat_ydensity()`).
## Warning: Removed 519 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Warning: Removed 518 rows containing missing values or values outside the scale range
## (`geom_line()`).
## Warning: Removed 519 rows containing non-finite outside the scale range
## (`stat_ydensity()`).
## Warning: Removed 519 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Warning: Removed 518 rows containing missing values or values outside the scale range
## (`geom_line()`).
## Warning: Removed 519 rows containing non-finite outside the scale range
## (`stat_ydensity()`).
## Warning: Removed 519 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Warning: Removed 518 rows containing missing values or values outside the scale range
## (`geom_line()`).
## Warning: Removed 519 rows containing non-finite outside the scale range
## (`stat_ydensity()`).
## Warning: Removed 519 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Warning: Removed 518 rows containing missing values or values outside the scale range
## (`geom_line()`).
## Warning: Removed 519 rows containing non-finite outside the scale range
## (`stat_ydensity()`).
## Warning: Removed 519 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Warning: Removed 518 rows containing missing values or values outside the scale range
## (`geom_line()`).
## Warning: Removed 519 rows containing non-finite outside the scale range
## (`stat_ydensity()`).
## Warning: Removed 519 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Warning: Removed 518 rows containing missing values or values outside the scale range
## (`geom_line()`).
## Warning: Removed 519 rows containing non-finite outside the scale range
## (`stat_ydensity()`).
## Warning: Removed 519 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Warning: Removed 518 rows containing missing values or values outside the scale range
## (`geom_line()`).
## Warning: Removed 519 rows containing non-finite outside the scale range
## (`stat_ydensity()`).
## Warning: Removed 519 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Warning: Removed 518 rows containing missing values or values outside the scale range
## (`geom_line()`).
## Warning: Removed 1083 rows containing non-finite outside the scale range
## (`stat_ydensity()`).
## Warning: Removed 1083 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Warning: Removed 1045 rows containing missing values or values outside the scale range
## (`geom_line()`).
## Warning: Removed 1520 rows containing non-finite outside the scale range
## (`stat_ydensity()`).
## Warning: Removed 1520 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Warning: Removed 1465 rows containing missing values or values outside the scale range
## (`geom_line()`).
## Warning: Removed 519 rows containing non-finite outside the scale range
## (`stat_ydensity()`).
## Warning: Removed 519 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Warning: Removed 518 rows containing missing values or values outside the scale range
## (`geom_line()`).
## Warning: Removed 519 rows containing non-finite outside the scale range
## (`stat_ydensity()`).
## Warning: Removed 519 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Warning: Removed 518 rows containing missing values or values outside the scale range
## (`geom_line()`).
## Warning: Removed 3034 rows containing non-finite outside the scale range
## (`stat_ydensity()`).
## Warning: Removed 3034 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Warning: Removed 2883 rows containing missing values or values outside the scale range
## (`geom_line()`).
## Warning: Removed 3034 rows containing non-finite outside the scale range
## (`stat_ydensity()`).
## Warning: Removed 3034 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Warning: Removed 2883 rows containing missing values or values outside the scale range
## (`geom_line()`).
# Clean up
rm(variables, var, data_filtered)

3.3.3 Pretonic: Averages prominence

3.3.3.1 Duration

What is the average duration of pretonic across the different prosodic prominence ratings in Catalan vs in German?

# Values
data_prepost %>% 
  group_by(language, percProm) %>%
  summarize(avg_duration = mean(durationPre, na.rm = TRUE))
# Plot
ggplot(data_prepost %>% filter(!is.na(percProm)), aes(x = language, y = durationPre, fill = as.factor(percProm))) +
  geom_violin(scale = "width", trim = FALSE, alpha = 0.3) +
  geom_boxplot(width = 0.1, outlier.shape = NA, position = position_dodge(width = 0.9), alpha = 0.5) +
  labs(
    #title = "Duration of Prosodic Prominence Ratings by Language",
    x = "Language",
    y = "Pretonic duration (total)",
    fill = "Prosodic prominence"
  ) +
  scale_fill_manual(values = colorBlindBlack8) +
  theme_minimal()

ggsave(filename = paste0(plots, "prominence_duration_pretonic.png"), plot = last_plot(), width = 6, height = 4)

3.3.3.2 Duration without silences

What is the average duration of sounding across the different prosodic prominence ratings in Catalan vs in German?

# Values
data_prepost %>% 
  group_by(language, percProm) %>%
  summarize(avg_duration_noSilence = mean(duration_noSilencePre, na.rm = TRUE))
# Plot
ggplot(data_prepost %>% filter(!is.na(percProm)), aes(x = language, y = duration_noSilencePre, fill = as.factor(percProm))) +
  geom_violin(scale = "width", trim = FALSE, alpha = 0.3) +
  geom_boxplot(width = 0.1, outlier.shape = NA, position = position_dodge(width = 0.9), alpha = 0.5) +
  labs(
    #title = "Duration of Prosodic Prominence Ratings by Language",
    x = "Language",
    y = "Pretonic duration (without silences)",
    fill = "Prosodic prominence"
  ) +
  scale_fill_manual(values = colorBlindBlack8) +
  theme_minimal()

ggsave(filename = paste0(plots, "prominence_duration_noSilence_pretonic.png"), plot = last_plot(), width = 6, height = 4)

3.3.3.3 Amplitude (median)

What is the average amplitude (median) across the different prosodic prominence ratings in Catalan vs in German?

# Values
data_prepost %>% 
  group_by(language, percProm) %>%
  summarize(avg_ampl_median = mean(ampl_medianPre, na.rm = TRUE))
# Plot
ggplot(data_prepost %>% filter(!is.na(percProm)), aes(x = language, y = ampl_medianPre, fill = as.factor(percProm))) +
  geom_violin(scale = "width", trim = FALSE, alpha = 0.3) +
  geom_boxplot(width = 0.1, outlier.shape = NA, position = position_dodge(width = 0.9), alpha = 0.5) +
  labs(
    #title = "Duration of Prosodic Prominence Ratings by Language",
    x = "Language",
    y = "Pretonic amplitude (medians)",
    fill = "Prosodic prominence"
  ) +
  scale_fill_manual(values = colorBlindBlack8) +
  theme_minimal()

ggsave(filename = paste0(plots, "prominence_ampl_median_pretonic.png"), plot = last_plot(), width = 6, height = 4)

3.3.3.4 Amplitude (sd)

What is the average amplitude (sd) across the different prosodic prominence ratings in Catalan vs in German?

# Values
data_prepost %>% 
  group_by(language, percProm) %>%
  summarize(avg_ampl_sd = mean(ampl_sdPre, na.rm = TRUE))
# Plot
ggplot(data_prepost %>% filter(!is.na(percProm)), aes(x = language, y = ampl_sdPre, fill = as.factor(percProm))) +
  geom_violin(scale = "width", trim = FALSE, alpha = 0.3) +
  geom_boxplot(width = 0.1, outlier.shape = NA, position = position_dodge(width = 0.9), alpha = 0.5) +
  labs(
    #title = "Duration of Prosodic Prominence Ratings by Language",
    x = "Language",
    y = "Pretonic amplitude (sd)",
    fill = "Prosodic prominence"
  ) +
  scale_fill_manual(values = colorBlindBlack8) +
  theme_minimal()

ggsave(filename = paste0(plots, "prominence_ampl_sd_pretonic.png"), plot = last_plot(), width = 6, height = 4)

3.3.3.5 Amplitude (median) without silences

What is the average amplitude (median) without silences across the different prosodic prominence ratings in Catalan vs in German?

# Values
data_prepost %>% 
  group_by(language, percProm) %>%
  summarize(avg_ampl_noSilence_median = mean(ampl_noSilence_medianPre, na.rm = TRUE))
# Plot
ggplot(data_prepost %>% filter(!is.na(percProm)), aes(x = language, y = ampl_noSilence_medianPre, fill = as.factor(percProm))) +
  geom_violin(scale = "width", trim = FALSE, alpha = 0.3) +
  geom_boxplot(width = 0.1, outlier.shape = NA, position = position_dodge(width = 0.9), alpha = 0.5) +
  labs(
    #title = "Duration of Prosodic Prominence Ratings by Language",
    x = "Language",
    y = "Pretonic amplitude without silences (medians)",
    fill = "Prosodic prominence"
  ) +
  scale_fill_manual(values = colorBlindBlack8) +
  theme_minimal()

ggsave(filename = paste0(plots, "prominence_ampl_noSilence_median_pretonic.png"), plot = last_plot(), width = 6, height = 4)

3.3.3.6 Amplitude (sd) without silences

What is the average amplitude (sd) without silences across the different prosodic prominence ratings in Catalan vs in German?

# Values
data_prepost %>% 
  group_by(language, percProm) %>%
  summarize(avg_ampl_noSilence_sd = mean(ampl_noSilence_sdPre, na.rm = TRUE))
# Plot
ggplot(data_prepost %>% filter(!is.na(percProm)), aes(x = language, y = ampl_noSilence_sdPre, fill = as.factor(percProm))) +
  geom_violin(scale = "width", trim = FALSE, alpha = 0.3) +
  geom_boxplot(width = 0.1, outlier.shape = NA, position = position_dodge(width = 0.9), alpha = 0.5) +
  labs(
    #title = "Duration of Prosodic Prominence Ratings by Language",
    x = "Language",
    y = "Pretonic amplitude without silences (sd)",
    fill = "Prosodic prominence"
  ) +
  scale_fill_manual(values = colorBlindBlack8) +
  theme_minimal()

ggsave(filename = paste0(plots, "prominence_ampl_noSilence_sd_pretonic.png"), plot = last_plot(), width = 6, height = 4)

3.3.3.7 Amplitude envelope slope

What is the average amplitude envelope slope across the different prosodic prominence ratings in Catalan vs in German?

# Values
data_prepost %>% 
  group_by(language, percProm) %>%
  summarize(avg_env_slope = mean(env_slopePre, na.rm = TRUE))
# Plot
ggplot(data_prepost %>% filter(!is.na(percProm)), aes(x = language, y = env_slopePre, fill = as.factor(percProm))) +
  geom_violin(scale = "width", trim = FALSE, alpha = 0.3) +
  geom_boxplot(width = 0.1, outlier.shape = NA, position = position_dodge(width = 0.9), alpha = 0.5) +
  labs(
    x = "Language",
    y = "Pretonic amplitude envelope slope",
    fill = "Prosodic prominence"
  ) +
  scale_fill_manual(values = colorBlindBlack8) +
  theme_minimal()

ggsave(filename = paste0(plots, "prominence_env_slope_pretonic.png"), plot = last_plot(), width = 6, height = 4)

3.3.3.8 Pitch (median)

What is the average pitch (median) across the different prosodic prominence ratings in Catalan vs in German?

#Vavlues
## Raw
avg_pitch_median_pre <- data_prepost %>% 
  group_by(language, percProm) %>%
  summarize(avg_pitch_median = mean(pitch_medianPre, na.rm = TRUE))

## Normalized
data_prepost %>% 
  group_by(language, percProm) %>%
  summarize(avg_pitch_median_norm = mean(pitch_median_normPre, na.rm = TRUE))
# Plots
## Raw
ggplot(data_prepost %>% filter(!is.na(percProm)), aes(x = language, y = pitch_medianPre, fill = as.factor(percProm))) +
  geom_violin(scale = "width", trim = FALSE, alpha = 0.3) +
  geom_boxplot(width = 0.1, outlier.shape = NA, position = position_dodge(width = 0.9), alpha = 0.5) +
  labs(
    x = "Language",
    y = "Pretonic f0 (raw medians)",
    fill = "Prosodic prominence"
  ) +
  scale_fill_manual(values = colorBlindBlack8) +
  theme_minimal()

ggsave(filename = paste0(plots, "prominence_pitch_median_raw_pretonic.png"), plot = last_plot(), width = 6, height = 4)

## Normalized
ggplot(data_prepost %>% filter(!is.na(percProm)), aes(x = language, y = pitch_median_normPre, fill = as.factor(percProm))) +
  geom_violin(scale = "width", trim = FALSE, alpha = 0.3) +
  geom_boxplot(width = 0.1, outlier.shape = NA, position = position_dodge(width = 0.9), alpha = 0.5) +
  labs(
    x = "Language",
    y = "Pretonic f0 (normalized medians)",
    fill = "Prosodic prominence"
  ) +
  scale_fill_manual(values = colorBlindBlack8) +
  theme_minimal()

ggsave(filename = paste0(plots, "prominence_pitch_median_norm_pretonic.png"), plot = last_plot(), width = 6, height = 4)

3.3.3.9 Pitch (sd)

What is the average pitch (sd) across the different prosodic prominence ratings in Catalan vs in German?

# Values
## Raw
data_prepost %>% 
  group_by(language, percProm) %>%
  summarize(avg_pitch_sd = mean(pitch_sdPre, na.rm = TRUE))
## Normalized
data_prepost %>% 
  group_by(language, percProm) %>%
  summarize(avg_pitch_sd = mean(pitch_sd_normPre, na.rm = TRUE))
# Plots
## Raw
ggplot(data_prepost %>% filter(!is.na(percProm)), aes(x = language, y = pitch_sdPre, fill = as.factor(percProm))) +
  geom_violin(scale = "width", trim = FALSE, alpha = 0.3) +
  geom_boxplot(width = 0.1, outlier.shape = NA, position = position_dodge(width = 0.9), alpha = 0.5) +
  labs(
    #title = "Duration of Prosodic Prominence Ratings by Language",
    x = "Language",
    y = "Pretonic f0 (raw sd)",
    fill = "Prosodic prominence"
  ) +
  scale_fill_manual(values = colorBlindBlack8) +
  theme_minimal()

ggsave(filename = paste0(plots, "prominence_pitch_sd_raw_pretonic.png"), plot = last_plot(), width = 6, height = 4)

## Normalized
ggplot(data_prepost %>% filter(!is.na(percProm)), aes(x = language, y = pitch_sd_normPre, fill = as.factor(percProm))) +
  geom_violin(scale = "width", trim = FALSE, alpha = 0.3) +
  geom_boxplot(width = 0.1, outlier.shape = NA, position = position_dodge(width = 0.9), alpha = 0.5) +
  labs(
    #title = "Duration of Prosodic Prominence Ratings by Language",
    x = "Language",
    y = "Pretonic f0 (normalized sd)",
    fill = "Prosodic prominence"
  ) +
  scale_fill_manual(values = colorBlindBlack8) +
  theme_minimal()

ggsave(filename = paste0(plots, "prominence_pitch_sd_norm_pretonic.png"), plot = last_plot(), width = 6, height = 4)

3.3.3.10 F0 slope

What is the average f0 slope across the different prosodic prominence ratings in Catalan vs in German?

#Values
## Raw
data_prepost %>% 
  group_by(language, percProm) %>%
  summarize(avg_f0_slope = mean(f0_slopePre, na.rm = TRUE))
## Normalized
data_prepost %>% 
  group_by(language, percProm) %>%
  summarize(avg_f0_slope = mean(f0_slope_normPre, na.rm = TRUE))
# Plots
## Raw
ggplot(data_prepost %>% filter(!is.na(percProm)), aes(x = language, y = f0_slopePre, fill = as.factor(percProm))) +
  geom_violin(scale = "width", trim = FALSE, alpha = 0.3) +
  geom_boxplot(width = 0.1, outlier.shape = NA, position = position_dodge(width = 0.9), alpha = 0.5) +
  labs(
    #title = "Duration of Prosodic Prominence Ratings by Language",
    x = "Language",
    y = "Pretonic f0 slope (raw)",
    fill = "Prosodic prominence"
  ) +
  scale_fill_manual(values = colorBlindBlack8) +
  theme_minimal()

ggsave(filename = paste0(plots, "prominence_f0_slope_raw_pretonic.png"), plot = last_plot(), width = 6, height = 4)

## Normalized
ggplot(data_prepost %>% filter(!is.na(percProm)), aes(x = language, y = f0_slope_normPre, fill = as.factor(percProm))) +
  geom_violin(scale = "width", trim = FALSE, alpha = 0.3) +
  geom_boxplot(width = 0.1, outlier.shape = NA, position = position_dodge(width = 0.9), alpha = 0.5) +
  labs(
    #title = "Duration of Prosodic Prominence Ratings by Language",
    x = "Language",
    y = "Pretonic f0 slope (normalized)",
    fill = "Prosodic prominence"
  ) +
  scale_fill_manual(values = colorBlindBlack8) +
  theme_minimal()

ggsave(filename = paste0(plots, "prominence_f0_slope_norm_pretonic.png"), plot = last_plot(), width = 6, height = 4)

3.3.3.11 CPP (median)

What is the average CPP (median) across the different prosodic prominence ratings in Catalan vs in German?

# Values
data_prepost %>% 
  group_by(language, percProm) %>%
  summarize(avg_CPP_median = mean(CPP_medianPre, na.rm = TRUE))
# Plot
ggplot(data_prepost %>% filter(!is.na(percProm)), aes(x = language, y = CPP_medianPre, fill = as.factor(percProm))) +
  geom_violin(scale = "width", trim = FALSE, alpha = 0.3) +
  geom_boxplot(width = 0.1, outlier.shape = NA, position = position_dodge(width = 0.9), alpha = 0.5) +
  labs(
    #title = "Duration of Prosodic Prominence Ratings by Language",
    x = "Language",
    y = "Pretonic CPP (medians)",
    fill = "Prosodic prominence"
  ) +
  scale_fill_manual(values = colorBlindBlack8) +
  theme_minimal()

ggsave(filename = paste0(plots, "prominence_CPP_median_pretonic.png"), plot = last_plot(), width = 6, height = 4)

3.3.3.12 CPP (sd)

What is the average CPP (sd) across the different prosodic prominence ratings in Catalan vs in German?

# Values
data_prepost %>% 
  group_by(language, percProm) %>%
  summarize(avg_CPP_sd = mean(CPP_sdPre, na.rm = TRUE))
# Plot
ggplot(data_prepost %>% filter(!is.na(percProm)), aes(x = language, y = CPP_sdPre, fill = as.factor(percProm))) +
  geom_violin(scale = "width", trim = FALSE, alpha = 0.3) +
  geom_boxplot(width = 0.1, outlier.shape = NA, position = position_dodge(width = 0.9), alpha = 0.5) +
  labs(
    #title = "Duration of Prosodic Prominence Ratings by Language",
    x = "Language",
    y = "Pretonic CPP (sd)",
    fill = "Prosodic prominence"
  ) +
  scale_fill_manual(values = colorBlindBlack8) +
  theme_minimal()

ggsave(filename = paste0(plots, "prominence_CPP_sd_pretonic.png"), plot = last_plot(), width = 6, height = 4)

3.3.3.13 Flux (median)

What is the average flux (median) across the different prosodic prominence ratings in Catalan vs in German?

# Values
data_prepost %>% 
  group_by(language, percProm) %>%
  summarize(avg_flux_median = mean(flux_medianPre, na.rm = TRUE))
# Plot
ggplot(data_prepost %>% filter(!is.na(percProm)), aes(x = language, y = flux_medianPre, fill = as.factor(percProm))) +
  geom_violin(scale = "width", trim = FALSE, alpha = 0.3) +
  geom_boxplot(width = 0.1, outlier.shape = NA, position = position_dodge(width = 0.9), alpha = 0.5) +
  labs(
    #title = "Duration of Prosodic Prominence Ratings by Language",
    x = "Language",
    y = "Pretonic flux (medians)",
    fill = "Prosodic prominence"
  ) +
  scale_fill_manual(values = colorBlindBlack8) +
  ylim(-0.025, 0.15) + # because of outliers
  theme_minimal()

ggsave(filename = paste0(plots, "prominence_flux_median_pretonic.png"), plot = last_plot(), width = 6, height = 4)

3.3.3.14 Flux (sd)

What is the average flux (sd) across the different prosodic prominence ratings in Catalan vs in German?

# Values
data_prepost %>% 
  group_by(language, percProm) %>%
  summarize(avg_flux_sd = mean(flux_sdPre, na.rm = TRUE))
# Plot
ggplot(data_prepost %>% filter(!is.na(percProm)), aes(x = language, y = flux_sdPre, fill = as.factor(percProm))) +
  geom_violin(scale = "width", trim = FALSE, alpha = 0.3) +
  geom_boxplot(width = 0.1, outlier.shape = NA, position = position_dodge(width = 0.9), alpha = 0.5) +
  labs(
    #title = "Duration of Prosodic Prominence Ratings by Language",
    x = "Language",
    y = "Pretonic flux (sd)",
    fill = "Prosodic prominence"
  ) +
  scale_fill_manual(values = colorBlindBlack8) +
  theme_minimal()

ggsave(filename = paste0(plots, "prominence_flux_sd_pretonic.png"), plot = last_plot(), width = 6, height = 4)

3.3.3.15 Novelty (median)

What is the average novelty (median) across the different prosodic prominence ratings in Catalan vs in German?

# Values
data_prepost %>% 
  group_by(language, percProm) %>%
  summarize(avg_novelty_median = mean(novelty_medianPre, na.rm = TRUE))
# Plot
ggplot(data_prepost %>% filter(!is.na(percProm)), aes(x = language, y = novelty_medianPre, fill = as.factor(percProm))) +
  geom_violin(scale = "width", trim = FALSE, alpha = 0.3) +
  geom_boxplot(width = 0.1, outlier.shape = NA, position = position_dodge(width = 0.9), alpha = 0.5) +
  labs(
    #title = "Duration of Prosodic Prominence Ratings by Language",
    x = "Language",
    y = "Pretonic novelty (medians)",
    fill = "Prosodic prominence"
  ) +
  scale_fill_manual(values = colorBlindBlack8) +
  theme_minimal()

ggsave(filename = paste0(plots, "prominence_novelty_median_pretonic.png"), plot = last_plot(), width = 6, height = 4)

3.3.3.16 Novelty (sd)

What is the average novelty (sd) across the different prosodic prominence ratings in Catalan vs in German?

# Values
data_prepost %>% 
  group_by(language, percProm) %>%
  summarize(avg_novelty_sd = mean(novelty_sdPre, na.rm = TRUE))
# Plot
ggplot(data_prepost %>% filter(!is.na(percProm)), aes(x = language, y = novelty_sdPre, fill = as.factor(percProm))) +
  geom_violin(scale = "width", trim = FALSE, alpha = 0.3) +
  geom_boxplot(width = 0.1, outlier.shape = NA, position = position_dodge(width = 0.9), alpha = 0.5) +
  labs(
    #title = "Duration of Prosodic Prominence Ratings by Language",
    x = "Language",
    y = "Pretonic novelty (sd)",
    fill = "Prosodic prominence"
  ) +
  scale_fill_manual(values = colorBlindBlack8) +
  theme_minimal()

ggsave(filename = paste0(plots, "prominence_novelty_sd_pretonic.png"), plot = last_plot(), width = 6, height = 4)

3.3.3.17 Spectral centroid (median)

What is the average spectral centroid (median) across the different prosodic prominence ratings in Catalan vs in German?

# Values
data_prepost %>% 
  group_by(language, percProm) %>%
  summarize(avg_specCentroid_median = mean(specCentroid_medianPre, na.rm = TRUE))
# Plot
ggplot(data_prepost %>% filter(!is.na(percProm)), aes(x = language, y = specCentroid_medianPre, fill = as.factor(percProm))) +
  geom_violin(scale = "width", trim = FALSE, alpha = 0.3) +
  geom_boxplot(width = 0.1, outlier.shape = NA, position = position_dodge(width = 0.9), alpha = 0.5) +
  labs(
    #title = "Duration of Prosodic Prominence Ratings by Language",
    x = "Language",
    y = "Pretonic spectral centroid (medians)",
    fill = "Prosodic prominence"
  ) +
  scale_fill_manual(values = colorBlindBlack8) +
  theme_minimal()

ggsave(filename = paste0(plots, "prominence_specCentroid_median_pretonic.png"), plot = last_plot(), width = 6, height = 4)

3.3.3.18 Spectral centroid (sd)

What is the average spectral centroid (sd) across the different prosodic prominence ratings in Catalan vs in German?

# Values
data_prepost %>% 
  group_by(language, percProm) %>%
  summarize(avg_specCentroid_sd = mean(specCentroid_sdPre, na.rm = TRUE))
# Plot
ggplot(data_prepost %>% filter(!is.na(percProm)), aes(x = language, y = specCentroid_sdPre, fill = as.factor(percProm))) +
  geom_violin(scale = "width", trim = FALSE, alpha = 0.3) +
  geom_boxplot(width = 0.1, outlier.shape = NA, position = position_dodge(width = 0.9), alpha = 0.5) +
  labs(
    #title = "Duration of Prosodic Prominence Ratings by Language",
    x = "Language",
    y = "Pretonic spectral centroid (sd)",
    fill = "Prosodic prominence"
  ) +
  scale_fill_manual(values = colorBlindBlack8) +
  theme_minimal()

ggsave(filename = paste0(plots, "prominence_specCentroid_sd_pretonic.png"), plot = last_plot(), width = 6, height = 4)

3.3.3.19 Weiner entropy (median)

What is the average Weiner entropy (median) across the different prosodic prominence ratings in Catalan vs in German?

# Values
data_prepost %>% 
  group_by(language, percProm) %>%
  summarize(avg_entropy_median = mean(entropy_medianPre, na.rm = TRUE))
# Plot
ggplot(data_prepost %>% filter(!is.na(percProm)), aes(x = language, y = entropy_medianPre, fill = as.factor(percProm))) +
  geom_violin(scale = "width", trim = FALSE, alpha = 0.3) +
  geom_boxplot(width = 0.1, outlier.shape = NA, position = position_dodge(width = 0.9), alpha = 0.5) +
  labs(
    #title = "Duration of Prosodic Prominence Ratings by Language",
    x = "Language",
    y = "Pretonic Weiner entropy (medians)",
    fill = "Prosodic prominence"
  ) +
  scale_fill_manual(values = colorBlindBlack8) +
  theme_minimal()

ggsave(filename = paste0(plots, "prominence_entropy_median_pretonic.png"), plot = last_plot(), width = 6, height = 4)

3.3.3.20 Weiner entropy (sd)

What is the average Weiner entropy (sd) across the different prosodic prominence ratings in Catalan vs in German?

# Values
data_prepost %>% 
  group_by(language, percProm) %>%
  summarize(avg_entropy_sd = mean(entropy_sdPre, na.rm = TRUE))
# Plot
ggplot(data_prepost %>% filter(!is.na(percProm)), aes(x = language, y = entropy_sdPre, fill = as.factor(percProm))) +
  geom_violin(scale = "width", trim = FALSE, alpha = 0.3) +
  geom_boxplot(width = 0.1, outlier.shape = NA, position = position_dodge(width = 0.9), alpha = 0.5) +
  labs(
    #title = "Duration of Prosodic Prominence Ratings by Language",
    x = "Language",
    y = "Pretonic Weiner entropy (sd)",
    fill = "Prosodic prominence"
  ) +
  scale_fill_manual(values = colorBlindBlack8) +
  theme_minimal()

ggsave(filename = paste0(plots, "prominence_entropy_sd_pretonic.png"), plot = last_plot(), width = 6, height = 4)

3.3.3.21 Shannon entropy (median)

What is the average Shannon entropy (median) across the different prosodic prominence ratings in Catalan vs in German?

# Values
data_prepost %>% 
  group_by(language, percProm) %>%
  summarize(avg_entropySh_median = mean(entropySh_medianPre, na.rm = TRUE))
# Plot
ggplot(data_prepost %>% filter(!is.na(percProm)), aes(x = language, y = entropySh_medianPre, fill = as.factor(percProm))) +
  geom_violin(scale = "width", trim = FALSE, alpha = 0.3) +
  geom_boxplot(width = 0.1, outlier.shape = NA, position = position_dodge(width = 0.9), alpha = 0.5) +
  labs(
    #title = "Duration of Prosodic Prominence Ratings by Language",
    x = "Language",
    y = "Pretonic Shannon entropy (medians)",
    fill = "Prosodic prominence"
  ) +
  scale_fill_manual(values = colorBlindBlack8) +
  theme_minimal()

ggsave(filename = paste0(plots, "prominence_entropySh_median_pretonic.png"), plot = last_plot(), width = 6, height = 4)

3.3.3.22 Shannon entropy (sd)

What is the average Shannon entropy (sd) across the different prosodic prominence ratings in Catalan vs in German?

# Values
data_prepost %>% 
  group_by(language, percProm) %>%
  summarize(avg_entropySh_sd = mean(entropySh_sdPre, na.rm = TRUE))
# Plot
ggplot(data_prepost %>% filter(!is.na(percProm)), aes(x = language, y = entropySh_sdPre, fill = as.factor(percProm))) +
  geom_violin(scale = "width", trim = FALSE, alpha = 0.3) +
  geom_boxplot(width = 0.1, outlier.shape = NA, position = position_dodge(width = 0.9), alpha = 0.5) +
  labs(
    #title = "Duration of Prosodic Prominence Ratings by Language",
    x = "Language",
    y = "Pretonic Shannon entropy (sd)",
    fill = "Prosodic prominence"
  ) +
  scale_fill_manual(values = colorBlindBlack8) +
  theme_minimal()

ggsave(filename = paste0(plots, "prominence_entropySh_sd_pretonic.png"), plot = last_plot(), width = 6, height = 4)

3.3.3.23 Harmonics-to-Noise Ratio (median)

What is the average Harmonics-to-Noise Ratio (median) across the different prosodic prominence ratings in Catalan vs in German?

# Values
data_prepost %>% 
  group_by(language, percProm) %>%
  summarize(avg_HNR_median = mean(HNR_medianPre, na.rm = TRUE))
# Plot
ggplot(data_prepost %>% filter(!is.na(percProm)), aes(x = language, y = HNR_medianPre, fill = as.factor(percProm))) +
  geom_violin(scale = "width", trim = FALSE, alpha = 0.3) +
  geom_boxplot(width = 0.1, outlier.shape = NA, position = position_dodge(width = 0.9), alpha = 0.5) +
  labs(
    #title = "Duration of Prosodic Prominence Ratings by Language",
    x = "Language",
    y = "Pretonic HNR (medians)",
    fill = "Prosodic prominence"
  ) +
  scale_fill_manual(values = colorBlindBlack8) +
  theme_minimal()

ggsave(filename = paste0(plots, "prominence_HNR_median_pretonic.png"), plot = last_plot(), width = 6, height = 4)

3.3.3.24 Harmonics-to-Noise Ratio (sd)

What is the average Harmonics-to-Noise Ratio (sd) across the different prosodic prominence ratings in Catalan vs in German?

# Values
data_prepost %>% 
  group_by(language, percProm) %>%
  summarize(avg_HNR_sd = mean(HNR_sdPre, na.rm = TRUE))
# Plot
ggplot(data_prepost %>% filter(!is.na(percProm)), aes(x = language, y = HNR_sdPre, fill = as.factor(percProm))) +
  geom_violin(scale = "width", trim = FALSE, alpha = 0.3) +
  geom_boxplot(width = 0.1, outlier.shape = NA, position = position_dodge(width = 0.9), alpha = 0.5) +
  labs(
    #title = "Duration of Prosodic Prominence Ratings by Language",
    x = "Language",
    y = "Pretonic HNR (sd)",
    fill = "Prosodic prominence"
  ) +
  scale_fill_manual(values = colorBlindBlack8) +
  theme_minimal()

ggsave(filename = paste0(plots, "prominence_HNR_sd_pretonic.pdf"), plot = last_plot(), width = 6, height = 4)

3.3.3.25 Amplitude modulation (median)

What is the average amplitude modulation (median) across the different prosodic prominence ratings in Catalan vs in German?

# Values
data_prepost %>% 
  group_by(language, percProm) %>%
  summarize(avg_amEnvDep_median = mean(amEnvDep_medianPre, na.rm = TRUE))
# Plot
ggplot(data_prepost %>% filter(!is.na(percProm)), aes(x = language, y = amEnvDep_medianPre, fill = as.factor(percProm))) +
  geom_violin(scale = "width", trim = FALSE, alpha = 0.3) +
  geom_boxplot(width = 0.1, outlier.shape = NA, position = position_dodge(width = 0.9), alpha = 0.5) +
  labs(
    #title = "Duration of Prosodic Prominence Ratings by Language",
    x = "Language",
    y = "Pretonic amplitude modulation (medians)",
    fill = "Prosodic prominence"
  ) +
  scale_fill_manual(values = colorBlindBlack8) +
  theme_minimal()

ggsave(filename = paste0(plots, "prominence_amEnvDep_median_pretonic.png"), plot = last_plot(), width = 6, height = 4)

3.3.3.26 Amplitude modulation (sd)

What is the average amplitude modulation (sd) across the different prosodic prominence ratings in Catalan vs in German?

# Values
data_prepost %>% 
  group_by(language, percProm) %>%
  summarize(avg_amEnvDep_sd = mean(amEnvDep_sdPre, na.rm = TRUE))
# Plot
ggplot(data_prepost %>% filter(!is.na(percProm)), aes(x = language, y = amEnvDep_sdPre, fill = as.factor(percProm))) +
  geom_violin(scale = "width", trim = FALSE, alpha = 0.3) +
  geom_boxplot(width = 0.1, outlier.shape = NA, position = position_dodge(width = 0.9), alpha = 0.5) +
  labs(
    #title = "Duration of Prosodic Prominence Ratings by Language",
    x = "Language",
    y = "Pretonic amplitude modulation (sd)",
    fill = "Prosodic prominence"
  ) +
  scale_fill_manual(values = colorBlindBlack8) +
  theme_minimal()

ggsave(filename = paste0(plots, "prominence_amEnvDep_sd_pretonic.png"), plot = last_plot(), width = 6, height = 4)

3.3.3.27 Frequency modulation (median)

What is the average frequency modulation (median) across the different prosodic prominence ratings in Catalan vs in German?

# Values
data_prepost %>% 
  group_by(language, percProm) %>%
  summarize(avg_fmDep_median = mean(fmDep_medianPre, na.rm = TRUE))
# Plot
ggplot(data_prepost %>% filter(!is.na(percProm)), aes(x = language, y = fmDep_medianPre, fill = as.factor(percProm))) +
  geom_violin(scale = "width", trim = FALSE, alpha = 0.3) +
  geom_boxplot(width = 0.1, outlier.shape = NA, position = position_dodge(width = 0.9), alpha = 0.5) +
  labs(
    #title = "Duration of Prosodic Prominence Ratings by Language",
    x = "Language",
    y = "Pretonic frequency modulation (medians)",
    fill = "Prosodic prominence"
  ) +
  scale_fill_manual(values = colorBlindBlack8) +
  theme_minimal()

ggsave(filename = paste0(plots, "prominence_fmDep_median_pretonic.png"), plot = last_plot(), width = 6, height = 4)

3.3.3.28 Frequency modulation (sd)

What is the average frequency modulation (sd) across the different prosodic prominence ratings in Catalan vs in German?

# Values
data_prepost %>% 
  group_by(language, percProm) %>%
  summarize(avg_fmDep_sd = mean(fmDep_sdPre, na.rm = TRUE))
# Plot
ggplot(data_prepost %>% filter(!is.na(percProm)), aes(x = language, y = fmDep_sdPre, fill = as.factor(percProm))) +
  geom_violin(scale = "width", trim = FALSE, alpha = 0.3) +
  geom_boxplot(width = 0.1, outlier.shape = NA, position = position_dodge(width = 0.9), alpha = 0.5) +
  labs(
    #title = "Duration of Prosodic Prominence Ratings by Language",
    x = "Language",
    y = "Pretonic frequency modulation (sds)",
    fill = "Prosodic prominence"
  ) +
  scale_fill_manual(values = colorBlindBlack8) +
  ylim(-0.07, 0.5) + #because of outliers
  theme_minimal()

ggsave(filename = paste0(plots, "prominence_fmDep_sd_pretonic.png"), plot = last_plot(), width = 6, height = 4)

3.3.4 Posttonic: Averages prominence

3.3.4.1 Duration

What is the average duration of pretonic across the different prosodic prominence ratings in Catalan vs in German?

# Values
data_prepost %>% 
  group_by(language, percProm) %>%
  summarize(avg_duration = mean(durationPost, na.rm = TRUE))
# Plot
ggplot(data_prepost %>% filter(!is.na(percProm)), aes(x = language, y = durationPost, fill = as.factor(percProm))) +
  geom_violin(scale = "width", trim = FALSE, alpha = 0.3) +
  geom_boxplot(width = 0.1, outlier.shape = NA, position = position_dodge(width = 0.9), alpha = 0.5) +
  labs(
    #title = "Duration of Prosodic Prominence Ratings by Language",
    x = "Language",
    y = "Posttonic duration (total)",
    fill = "Prosodic prominence"
  ) +
  scale_fill_manual(values = colorBlindBlack8) +
  theme_minimal()

ggsave(filename = paste0(plots, "prominence_duration_posttonic.png"), plot = last_plot(), width = 6, height = 4)

3.3.4.2 Duration without silences

What is the average duration of sounding across the different prosodic prominence ratings in Catalan vs in German?

# Values
data_prepost %>% 
  group_by(language, percProm) %>%
  summarize(avg_duration_noSilence = mean(duration_noSilencePost, na.rm = TRUE))
# Plot
ggplot(data_prepost %>% filter(!is.na(percProm)), aes(x = language, y = duration_noSilencePost, fill = as.factor(percProm))) +
  geom_violin(scale = "width", trim = FALSE, alpha = 0.3) +
  geom_boxplot(width = 0.1, outlier.shape = NA, position = position_dodge(width = 0.9), alpha = 0.5) +
  labs(
    #title = "Duration of Prosodic Prominence Ratings by Language",
    x = "Language",
    y = "Posttonic duration (without silences)",
    fill = "Prosodic prominence"
  ) +
  scale_fill_manual(values = colorBlindBlack8) +
  theme_minimal()

ggsave(filename = paste0(plots, "prominence_duration_noSilence_posttonic.png"), plot = last_plot(), width = 6, height = 4)

3.3.4.3 Amplitude (median)

What is the average amplitude (median) across the different prosodic prominence ratings in Catalan vs in German?

# Values
data_prepost %>% 
  group_by(language, percProm) %>%
  summarize(avg_ampl_median = mean(ampl_medianPost, na.rm = TRUE))
# Plot
ggplot(data_prepost %>% filter(!is.na(percProm)), aes(x = language, y = ampl_medianPost, fill = as.factor(percProm))) +
  geom_violin(scale = "width", trim = FALSE, alpha = 0.3) +
  geom_boxplot(width = 0.1, outlier.shape = NA, position = position_dodge(width = 0.9), alpha = 0.5) +
  labs(
    #title = "Duration of Prosodic Prominence Ratings by Language",
    x = "Language",
    y = "Posttonic amplitude (medians)",
    fill = "Prosodic prominence"
  ) +
  scale_fill_manual(values = colorBlindBlack8) +
  theme_minimal()

ggsave(filename = paste0(plots, "prominence_ampl_median_posttonic.png"), plot = last_plot(), width = 6, height = 4)

3.3.4.4 Amplitude (sd)

What is the average amplitude (sd) across the different prosodic prominence ratings in Catalan vs in German?

# Values
data_prepost %>% 
  group_by(language, percProm) %>%
  summarize(avg_ampl_sd = mean(ampl_sdPost, na.rm = TRUE))
# Plot
ggplot(data_prepost %>% filter(!is.na(percProm)), aes(x = language, y = ampl_sdPost, fill = as.factor(percProm))) +
  geom_violin(scale = "width", trim = FALSE, alpha = 0.3) +
  geom_boxplot(width = 0.1, outlier.shape = NA, position = position_dodge(width = 0.9), alpha = 0.5) +
  labs(
    #title = "Duration of Prosodic Prominence Ratings by Language",
    x = "Language",
    y = "Posttonic amplitude (sd)",
    fill = "Prosodic prominence"
  ) +
  scale_fill_manual(values = colorBlindBlack8) +
  theme_minimal()

ggsave(filename = paste0(plots, "prominence_ampl_sd_posttonic.png"), plot = last_plot(), width = 6, height = 4)

3.3.4.5 Amplitude (median) without silences

What is the average amplitude (median) without silences across the different prosodic prominence ratings in Catalan vs in German?

# Values
data_prepost %>% 
  group_by(language, percProm) %>%
  summarize(avg_ampl_noSilence_median = mean(ampl_noSilence_medianPost, na.rm = TRUE))
# Plot
ggplot(data_prepost %>% filter(!is.na(percProm)), aes(x = language, y = ampl_noSilence_medianPost, fill = as.factor(percProm))) +
  geom_violin(scale = "width", trim = FALSE, alpha = 0.3) +
  geom_boxplot(width = 0.1, outlier.shape = NA, position = position_dodge(width = 0.9), alpha = 0.5) +
  labs(
    #title = "Duration of Prosodic Prominence Ratings by Language",
    x = "Language",
    y = "Posttonic amplitude without silences (medians)",
    fill = "Prosodic prominence"
  ) +
  scale_fill_manual(values = colorBlindBlack8) +
  theme_minimal()

ggsave(filename = paste0(plots, "prominence_ampl_noSilence_median_posttonic.png"), plot = last_plot(), width = 6, height = 4)

3.3.4.6 Amplitude (sd) without silences

What is the average amplitude (sd) without silences across the different prosodic prominence ratings in Catalan vs in German?

# Values
data_prepost %>% 
  group_by(language, percProm) %>%
  summarize(avg_ampl_noSilence_sd = mean(ampl_noSilence_sdPost, na.rm = TRUE))
# Plot
ggplot(data_prepost %>% filter(!is.na(percProm)), aes(x = language, y = ampl_noSilence_sdPost, fill = as.factor(percProm))) +
  geom_violin(scale = "width", trim = FALSE, alpha = 0.3) +
  geom_boxplot(width = 0.1, outlier.shape = NA, position = position_dodge(width = 0.9), alpha = 0.5) +
  labs(
    #title = "Duration of Prosodic Prominence Ratings by Language",
    x = "Language",
    y = "Posttonic amplitude without silences (sd)",
    fill = "Prosodic prominence"
  ) +
  scale_fill_manual(values = colorBlindBlack8) +
  theme_minimal()

ggsave(filename = paste0(plots, "prominence_ampl_noSilence_sd_posttonic.png"), plot = last_plot(), width = 6, height = 4)

3.3.4.7 Amplitude envelope slope

What is the average amplitude envelope slope across the different prosodic prominence ratings in Catalan vs in German?

# Values
data_prepost %>% 
  group_by(language, percProm) %>%
  summarize(avg_env_slope = mean(env_slopePost, na.rm = TRUE))
# Plot
ggplot(data_prepost %>% filter(!is.na(percProm)), aes(x = language, y = env_slopePost, fill = as.factor(percProm))) +
  geom_violin(scale = "width", trim = FALSE, alpha = 0.3) +
  geom_boxplot(width = 0.1, outlier.shape = NA, position = position_dodge(width = 0.9), alpha = 0.5) +
  labs(
    x = "Language",
    y = "Posttonic amplitude envelope slope",
    fill = "Prosodic prominence"
  ) +
  scale_fill_manual(values = colorBlindBlack8) +
  theme_minimal()

ggsave(filename = paste0(plots, "prominence_env_slope_posttonic.png"), plot = last_plot(), width = 6, height = 4)

3.3.4.8 Pitch (median)

What is the average pitch (median) across the different prosodic prominence ratings in Catalan vs in German?

#Vavlues
## Raw
avg_pitch_median_pre <- data_prepost %>% 
  group_by(language, percProm) %>%
  summarize(avg_pitch_median = mean(pitch_medianPost, na.rm = TRUE))

## Normalized
data_prepost %>% 
  group_by(language, percProm) %>%
  summarize(avg_pitch_median_norm = mean(pitch_median_normPost, na.rm = TRUE))
# Plots
## Raw
ggplot(data_prepost %>% filter(!is.na(percProm)), aes(x = language, y = pitch_medianPost, fill = as.factor(percProm))) +
  geom_violin(scale = "width", trim = FALSE, alpha = 0.3) +
  geom_boxplot(width = 0.1, outlier.shape = NA, position = position_dodge(width = 0.9), alpha = 0.5) +
  labs(
    x = "Language",
    y = "Posttonic f0 (raw medians)",
    fill = "Prosodic prominence"
  ) +
  scale_fill_manual(values = colorBlindBlack8) +
  theme_minimal()

ggsave(filename = paste0(plots, "prominence_pitch_median_raw_posttonic.png"), plot = last_plot(), width = 6, height = 4)

## Normalized
ggplot(data_prepost %>% filter(!is.na(percProm)), aes(x = language, y = pitch_median_normPost, fill = as.factor(percProm))) +
  geom_violin(scale = "width", trim = FALSE, alpha = 0.3) +
  geom_boxplot(width = 0.1, outlier.shape = NA, position = position_dodge(width = 0.9), alpha = 0.5) +
  labs(
    x = "Language",
    y = "Posttonic f0 (normalized medians)",
    fill = "Prosodic prominence"
  ) +
  scale_fill_manual(values = colorBlindBlack8) +
  theme_minimal()

ggsave(filename = paste0(plots, "prominence_pitch_median_norm_posttonic.png"), plot = last_plot(), width = 6, height = 4)

3.3.4.9 Pitch (sd)

What is the average pitch (sd) across the different prosodic prominence ratings in Catalan vs in German?

# Values
## Raw
data_prepost %>% 
  group_by(language, percProm) %>%
  summarize(avg_pitch_sd = mean(pitch_sdPost, na.rm = TRUE))
## Normalized
data_prepost %>% 
  group_by(language, percProm) %>%
  summarize(avg_pitch_sd = mean(pitch_sd_normPost, na.rm = TRUE))
# Plots
## Raw
ggplot(data_prepost %>% filter(!is.na(percProm)), aes(x = language, y = pitch_sdPost, fill = as.factor(percProm))) +
  geom_violin(scale = "width", trim = FALSE, alpha = 0.3) +
  geom_boxplot(width = 0.1, outlier.shape = NA, position = position_dodge(width = 0.9), alpha = 0.5) +
  labs(
    #title = "Duration of Prosodic Prominence Ratings by Language",
    x = "Language",
    y = "Posttonic f0 (raw sd)",
    fill = "Prosodic prominence"
  ) +
  scale_fill_manual(values = colorBlindBlack8) +
  theme_minimal()

ggsave(filename = paste0(plots, "prominence_pitch_sd_raw_posttonic.png"), plot = last_plot(), width = 6, height = 4)

## Normalized
ggplot(data_prepost %>% filter(!is.na(percProm)), aes(x = language, y = pitch_sd_normPost, fill = as.factor(percProm))) +
  geom_violin(scale = "width", trim = FALSE, alpha = 0.3) +
  geom_boxplot(width = 0.1, outlier.shape = NA, position = position_dodge(width = 0.9), alpha = 0.5) +
  labs(
    #title = "Duration of Prosodic Prominence Ratings by Language",
    x = "Language",
    y = "Posttonic f0 (normalized sd)",
    fill = "Prosodic prominence"
  ) +
  scale_fill_manual(values = colorBlindBlack8) +
  theme_minimal()

ggsave(filename = paste0(plots, "prominence_pitch_sd_norm_posttonic.png"), plot = last_plot(), width = 6, height = 4)

3.3.4.10 F0 slope

What is the average f0 slope across the different prosodic prominence ratings in Catalan vs in German?

#Values
## Raw
data_prepost %>% 
  group_by(language, percProm) %>%
  summarize(avg_f0_slope = mean(f0_slopePost, na.rm = TRUE))
## Normalized
data_prepost %>% 
  group_by(language, percProm) %>%
  summarize(avg_f0_slope = mean(f0_slope_normPost, na.rm = TRUE))
# Plots
## Raw
ggplot(data_prepost %>% filter(!is.na(percProm)), aes(x = language, y = f0_slopePost, fill = as.factor(percProm))) +
  geom_violin(scale = "width", trim = FALSE, alpha = 0.3) +
  geom_boxplot(width = 0.1, outlier.shape = NA, position = position_dodge(width = 0.9), alpha = 0.5) +
  labs(
    #title = "Duration of Prosodic Prominence Ratings by Language",
    x = "Language",
    y = "Posttonic f0 slope (raw)",
    fill = "Prosodic prominence"
  ) +
  scale_fill_manual(values = colorBlindBlack8) +
  theme_minimal()

ggsave(filename = paste0(plots, "prominence_f0_slope_raw_posttonic.png"), plot = last_plot(), width = 6, height = 4)

## Normalized
ggplot(data_prepost %>% filter(!is.na(percProm)), aes(x = language, y = f0_slope_normPost, fill = as.factor(percProm))) +
  geom_violin(scale = "width", trim = FALSE, alpha = 0.3) +
  geom_boxplot(width = 0.1, outlier.shape = NA, position = position_dodge(width = 0.9), alpha = 0.5) +
  labs(
    #title = "Duration of Prosodic Prominence Ratings by Language",
    x = "Language",
    y = "Posttonic f0 slope (normalized)",
    fill = "Prosodic prominence"
  ) +
  scale_fill_manual(values = colorBlindBlack8) +
  theme_minimal()

ggsave(filename = paste0(plots, "prominence_f0_slope_norm_posttonic.png"), plot = last_plot(), width = 6, height = 4)

3.3.4.11 CPP (median)

What is the average CPP (median) across the different prosodic prominence ratings in Catalan vs in German?

# Values
data_prepost %>% 
  group_by(language, percProm) %>%
  summarize(avg_CPP_median = mean(CPP_medianPost, na.rm = TRUE))
# Plot
ggplot(data_prepost %>% filter(!is.na(percProm)), aes(x = language, y = CPP_medianPost, fill = as.factor(percProm))) +
  geom_violin(scale = "width", trim = FALSE, alpha = 0.3) +
  geom_boxplot(width = 0.1, outlier.shape = NA, position = position_dodge(width = 0.9), alpha = 0.5) +
  labs(
    #title = "Duration of Prosodic Prominence Ratings by Language",
    x = "Language",
    y = "Posttonic CPP (medians)",
    fill = "Prosodic prominence"
  ) +
  scale_fill_manual(values = colorBlindBlack8) +
  theme_minimal()

ggsave(filename = paste0(plots, "prominence_CPP_median_posttonic.png"), plot = last_plot(), width = 6, height = 4)

3.3.4.12 CPP (sd)

What is the average CPP (sd) across the different prosodic prominence ratings in Catalan vs in German?

# Values
data_prepost %>% 
  group_by(language, percProm) %>%
  summarize(avg_CPP_sd = mean(CPP_sdPost, na.rm = TRUE))
# Plot
ggplot(data_prepost %>% filter(!is.na(percProm)), aes(x = language, y = CPP_sdPost, fill = as.factor(percProm))) +
  geom_violin(scale = "width", trim = FALSE, alpha = 0.3) +
  geom_boxplot(width = 0.1, outlier.shape = NA, position = position_dodge(width = 0.9), alpha = 0.5) +
  labs(
    #title = "Duration of Prosodic Prominence Ratings by Language",
    x = "Language",
    y = "Posttonic CPP (sd)",
    fill = "Prosodic prominence"
  ) +
  scale_fill_manual(values = colorBlindBlack8) +
  theme_minimal()

ggsave(filename = paste0(plots, "prominence_CPP_sd_posttonic.png"), plot = last_plot(), width = 6, height = 4)

3.3.4.13 Flux (median)

What is the average flux (median) across the different prosodic prominence ratings in Catalan vs in German?

# Values
data_prepost %>% 
  group_by(language, percProm) %>%
  summarize(avg_flux_median = mean(flux_medianPost, na.rm = TRUE))
# Plot
ggplot(data_prepost %>% filter(!is.na(percProm)), aes(x = language, y = flux_medianPost, fill = as.factor(percProm))) +
  geom_violin(scale = "width", trim = FALSE, alpha = 0.3) +
  geom_boxplot(width = 0.1, outlier.shape = NA, position = position_dodge(width = 0.9), alpha = 0.5) +
  labs(
    #title = "Duration of Prosodic Prominence Ratings by Language",
    x = "Language",
    y = "Posttonic flux (medians)",
    fill = "Prosodic prominence"
  ) +
  scale_fill_manual(values = colorBlindBlack8) +
  ylim(-0.025, 0.15) + # because of outliers
  theme_minimal()

ggsave(filename = paste0(plots, "prominence_flux_median_posttonic.png"), plot = last_plot(), width = 6, height = 4)

3.3.4.14 Flux (sd)

What is the average flux (sd) across the different prosodic prominence ratings in Catalan vs in German?

# Values
data_prepost %>% 
  group_by(language, percProm) %>%
  summarize(avg_flux_sd = mean(flux_sdPost, na.rm = TRUE))
# Plot
ggplot(data_prepost %>% filter(!is.na(percProm)), aes(x = language, y = flux_sdPost, fill = as.factor(percProm))) +
  geom_violin(scale = "width", trim = FALSE, alpha = 0.3) +
  geom_boxplot(width = 0.1, outlier.shape = NA, position = position_dodge(width = 0.9), alpha = 0.5) +
  labs(
    #title = "Duration of Prosodic Prominence Ratings by Language",
    x = "Language",
    y = "Posttonic flux (sd)",
    fill = "Prosodic prominence"
  ) +
  scale_fill_manual(values = colorBlindBlack8) +
  theme_minimal()

ggsave(filename = paste0(plots, "prominence_flux_sd_posttonic.png"), plot = last_plot(), width = 6, height = 4)

3.3.4.15 Novelty (median)

What is the average novelty (median) across the different prosodic prominence ratings in Catalan vs in German?

# Values
data_prepost %>% 
  group_by(language, percProm) %>%
  summarize(avg_novelty_median = mean(novelty_medianPost, na.rm = TRUE))
# Plot
ggplot(data_prepost %>% filter(!is.na(percProm)), aes(x = language, y = novelty_medianPost, fill = as.factor(percProm))) +
  geom_violin(scale = "width", trim = FALSE, alpha = 0.3) +
  geom_boxplot(width = 0.1, outlier.shape = NA, position = position_dodge(width = 0.9), alpha = 0.5) +
  labs(
    #title = "Duration of Prosodic Prominence Ratings by Language",
    x = "Language",
    y = "Posttonic novelty (medians)",
    fill = "Prosodic prominence"
  ) +
  scale_fill_manual(values = colorBlindBlack8) +
  theme_minimal()

ggsave(filename = paste0(plots, "prominence_novelty_median_posttonic.png"), plot = last_plot(), width = 6, height = 4)

3.3.4.16 Novelty (sd)

What is the average novelty (sd) across the different prosodic prominence ratings in Catalan vs in German?

# Values
data_prepost %>% 
  group_by(language, percProm) %>%
  summarize(avg_novelty_sd = mean(novelty_sdPost, na.rm = TRUE))
# Plot
ggplot(data_prepost %>% filter(!is.na(percProm)), aes(x = language, y = novelty_sdPost, fill = as.factor(percProm))) +
  geom_violin(scale = "width", trim = FALSE, alpha = 0.3) +
  geom_boxplot(width = 0.1, outlier.shape = NA, position = position_dodge(width = 0.9), alpha = 0.5) +
  labs(
    #title = "Duration of Prosodic Prominence Ratings by Language",
    x = "Language",
    y = "Posttonic novelty (sd)",
    fill = "Prosodic prominence"
  ) +
  scale_fill_manual(values = colorBlindBlack8) +
  theme_minimal()

ggsave(filename = paste0(plots, "prominence_novelty_sd_posttonic.png"), plot = last_plot(), width = 6, height = 4)

3.3.4.17 Spectral centroid (median)

What is the average spectral centroid (median) across the different prosodic prominence ratings in Catalan vs in German?

# Values
data_prepost %>% 
  group_by(language, percProm) %>%
  summarize(avg_specCentroid_median = mean(specCentroid_medianPost, na.rm = TRUE))
# Plot
ggplot(data_prepost %>% filter(!is.na(percProm)), aes(x = language, y = specCentroid_medianPost, fill = as.factor(percProm))) +
  geom_violin(scale = "width", trim = FALSE, alpha = 0.3) +
  geom_boxplot(width = 0.1, outlier.shape = NA, position = position_dodge(width = 0.9), alpha = 0.5) +
  labs(
    #title = "Duration of Prosodic Prominence Ratings by Language",
    x = "Language",
    y = "Posttonic spectral centroid (medians)",
    fill = "Prosodic prominence"
  ) +
  scale_fill_manual(values = colorBlindBlack8) +
  theme_minimal()

ggsave(filename = paste0(plots, "prominence_specCentroid_median_posttonic.png"), plot = last_plot(), width = 6, height = 4)

3.3.4.18 Spectral centroid (sd)

What is the average spectral centroid (sd) across the different prosodic prominence ratings in Catalan vs in German?

# Values
data_prepost %>% 
  group_by(language, percProm) %>%
  summarize(avg_specCentroid_sd = mean(specCentroid_sdPost, na.rm = TRUE))
# Plot
ggplot(data_prepost %>% filter(!is.na(percProm)), aes(x = language, y = specCentroid_sdPost, fill = as.factor(percProm))) +
  geom_violin(scale = "width", trim = FALSE, alpha = 0.3) +
  geom_boxplot(width = 0.1, outlier.shape = NA, position = position_dodge(width = 0.9), alpha = 0.5) +
  labs(
    #title = "Duration of Prosodic Prominence Ratings by Language",
    x = "Language",
    y = "Posttonic spectral centroid (sd)",
    fill = "Prosodic prominence"
  ) +
  scale_fill_manual(values = colorBlindBlack8) +
  theme_minimal()

ggsave(filename = paste0(plots, "prominence_specCentroid_sd_posttonic.png"), plot = last_plot(), width = 6, height = 4)

3.3.4.19 Weiner entropy (median)

What is the average Weiner entropy (median) across the different prosodic prominence ratings in Catalan vs in German?

# Values
data_prepost %>% 
  group_by(language, percProm) %>%
  summarize(avg_entropy_median = mean(entropy_medianPost, na.rm = TRUE))
# Plot
ggplot(data_prepost %>% filter(!is.na(percProm)), aes(x = language, y = entropy_medianPost, fill = as.factor(percProm))) +
  geom_violin(scale = "width", trim = FALSE, alpha = 0.3) +
  geom_boxplot(width = 0.1, outlier.shape = NA, position = position_dodge(width = 0.9), alpha = 0.5) +
  labs(
    #title = "Duration of Prosodic Prominence Ratings by Language",
    x = "Language",
    y = "Posttonic Weiner entropy (medians)",
    fill = "Prosodic prominence"
  ) +
  scale_fill_manual(values = colorBlindBlack8) +
  theme_minimal()

ggsave(filename = paste0(plots, "prominence_entropy_median_postonic.png"), plot = last_plot(), width = 6, height = 4)

3.3.4.20 Weiner entropy (sd)

What is the average Weiner entropy (sd) across the different prosodic prominence ratings in Catalan vs in German?

# Values
data_prepost %>% 
  group_by(language, percProm) %>%
  summarize(avg_entropy_sd = mean(entropy_sdPost, na.rm = TRUE))
# Plot
ggplot(data_prepost %>% filter(!is.na(percProm)), aes(x = language, y = entropy_sdPost, fill = as.factor(percProm))) +
  geom_violin(scale = "width", trim = FALSE, alpha = 0.3) +
  geom_boxplot(width = 0.1, outlier.shape = NA, position = position_dodge(width = 0.9), alpha = 0.5) +
  labs(
    #title = "Duration of Prosodic Prominence Ratings by Language",
    x = "Language",
    y = "Posttonic Weiner entropy (sd)",
    fill = "Prosodic prominence"
  ) +
  scale_fill_manual(values = colorBlindBlack8) +
  theme_minimal()

ggsave(filename = paste0(plots, "prominence_entropy_sd_postonic.png"), plot = last_plot(), width = 6, height = 4)

3.3.4.21 Shannon entropy (median)

What is the average Shannon entropy (median) across the different prosodic prominence ratings in Catalan vs in German?

# Values
data_prepost %>% 
  group_by(language, percProm) %>%
  summarize(avg_entropySh_median = mean(entropySh_medianPost, na.rm = TRUE))
# Plot
ggplot(data_prepost %>% filter(!is.na(percProm)), aes(x = language, y = entropySh_medianPost, fill = as.factor(percProm))) +
  geom_violin(scale = "width", trim = FALSE, alpha = 0.3) +
  geom_boxplot(width = 0.1, outlier.shape = NA, position = position_dodge(width = 0.9), alpha = 0.5) +
  labs(
    #title = "Duration of Prosodic Prominence Ratings by Language",
    x = "Language",
    y = "Posttonic Shannon entropy (medians)",
    fill = "Prosodic prominence"
  ) +
  scale_fill_manual(values = colorBlindBlack8) +
  theme_minimal()

ggsave(filename = paste0(plots, "prominence_entropySh_median_postonic.png"), plot = last_plot(), width = 6, height = 4)

3.3.4.22 Shannon entropy (sd)

What is the average Shannon entropy (sd) across the different prosodic prominence ratings in Catalan vs in German?

# Values
data_prepost %>% 
  group_by(language, percProm) %>%
  summarize(avg_entropySh_sd = mean(entropySh_sdPost, na.rm = TRUE))
# Plot
ggplot(data_prepost %>% filter(!is.na(percProm)), aes(x = language, y = entropySh_sdPost, fill = as.factor(percProm))) +
  geom_violin(scale = "width", trim = FALSE, alpha = 0.3) +
  geom_boxplot(width = 0.1, outlier.shape = NA, position = position_dodge(width = 0.9), alpha = 0.5) +
  labs(
    #title = "Duration of Prosodic Prominence Ratings by Language",
    x = "Language",
    y = "Posttonic Shannon entropy (sd)",
    fill = "Prosodic prominence"
  ) +
  scale_fill_manual(values = colorBlindBlack8) +
  theme_minimal()

ggsave(filename = paste0(plots, "prominence_entropySh_sd_postonic.png"), plot = last_plot(), width = 6, height = 4)

3.3.4.23 Harmonics-to-Noise Ratio (median)

What is the average Harmonics-to-Noise Ratio (median) across the different prosodic prominence ratings in Catalan vs in German?

# Values
data_prepost %>% 
  group_by(language, percProm) %>%
  summarize(avg_HNR_median = mean(HNR_medianPost, na.rm = TRUE))
# Plot
ggplot(data_prepost %>% filter(!is.na(percProm)), aes(x = language, y = HNR_medianPost, fill = as.factor(percProm))) +
  geom_violin(scale = "width", trim = FALSE, alpha = 0.3) +
  geom_boxplot(width = 0.1, outlier.shape = NA, position = position_dodge(width = 0.9), alpha = 0.5) +
  labs(
    #title = "Duration of Prosodic Prominence Ratings by Language",
    x = "Language",
    y = "Posttonic HNR (medians)",
    fill = "Prosodic prominence"
  ) +
  scale_fill_manual(values = colorBlindBlack8) +
  theme_minimal()

ggsave(filename = paste0(plots, "prominence_HNR_median_posttonic.png"), plot = last_plot(), width = 6, height = 4)

3.3.4.24 Harmonics-to-Noise Ratio (sd)

What is the average Harmonics-to-Noise Ratio (sd) across the different prosodic prominence ratings in Catalan vs in German?

# Values
data_prepost %>% 
  group_by(language, percProm) %>%
  summarize(avg_HNR_sd = mean(HNR_sdPost, na.rm = TRUE))
# Plot
ggplot(data_prepost %>% filter(!is.na(percProm)), aes(x = language, y = HNR_sdPost, fill = as.factor(percProm))) +
  geom_violin(scale = "width", trim = FALSE, alpha = 0.3) +
  geom_boxplot(width = 0.1, outlier.shape = NA, position = position_dodge(width = 0.9), alpha = 0.5) +
  labs(
    #title = "Duration of Prosodic Prominence Ratings by Language",
    x = "Language",
    y = "Posttonic HNR (sd)",
    fill = "Prosodic prominence"
  ) +
  scale_fill_manual(values = colorBlindBlack8) +
  theme_minimal()

ggsave(filename = paste0(plots, "prominence_HNR_sd_posttonic.png"), plot = last_plot(), width = 6, height = 4)

3.3.4.25 Amplitude modulation (median)

What is the average amplitude modulation (median) across the different prosodic prominence ratings in Catalan vs in German?

# Values
data_prepost %>% 
  group_by(language, percProm) %>%
  summarize(avg_amEnvDep_median = mean(amEnvDep_medianPost, na.rm = TRUE))
# Plot
ggplot(data_prepost %>% filter(!is.na(percProm)), aes(x = language, y = amEnvDep_medianPost, fill = as.factor(percProm))) +
  geom_violin(scale = "width", trim = FALSE, alpha = 0.3) +
  geom_boxplot(width = 0.1, outlier.shape = NA, position = position_dodge(width = 0.9), alpha = 0.5) +
  labs(
    #title = "Duration of Prosodic Prominence Ratings by Language",
    x = "Language",
    y = "Posttonic amplitude modulation (medians)",
    fill = "Prosodic prominence"
  ) +
  scale_fill_manual(values = colorBlindBlack8) +
  theme_minimal()

ggsave(filename = paste0(plots, "prominence_amEnvDep_median_posttonic.png"), plot = last_plot(), width = 6, height = 4)

3.3.4.26 Amplitude modulation (sd)

What is the average amplitude modulation (sd) across the different prosodic prominence ratings in Catalan vs in German?

# Values
data_prepost %>% 
  group_by(language, percProm) %>%
  summarize(avg_amEnvDep_sd = mean(amEnvDep_sdPost, na.rm = TRUE))
# Plot
ggplot(data_prepost %>% filter(!is.na(percProm)), aes(x = language, y = amEnvDep_sdPost, fill = as.factor(percProm))) +
  geom_violin(scale = "width", trim = FALSE, alpha = 0.3) +
  geom_boxplot(width = 0.1, outlier.shape = NA, position = position_dodge(width = 0.9), alpha = 0.5) +
  labs(
    #title = "Duration of Prosodic Prominence Ratings by Language",
    x = "Language",
    y = "Posttonic amplitude modulation (sd)",
    fill = "Prosodic prominence"
  ) +
  scale_fill_manual(values = colorBlindBlack8) +
  theme_minimal()

ggsave(filename = paste0(plots, "prominence_amEnvDep_sd_posttonic.png"), plot = last_plot(), width = 6, height = 4)

3.3.4.27 Frequency modulation (median)

What is the average frequency modulation (median) across the different prosodic prominence ratings in Catalan vs in German?

# Values
data_prepost %>% 
  group_by(language, percProm) %>%
  summarize(avg_fmDep_median = mean(fmDep_medianPost, na.rm = TRUE))
# Plot
ggplot(data_prepost %>% filter(!is.na(percProm)), aes(x = language, y = fmDep_medianPost, fill = as.factor(percProm))) +
  geom_violin(scale = "width", trim = FALSE, alpha = 0.3) +
  geom_boxplot(width = 0.1, outlier.shape = NA, position = position_dodge(width = 0.9), alpha = 0.5) +
  labs(
    #title = "Duration of Prosodic Prominence Ratings by Language",
    x = "Language",
    y = "Posttonic frequency modulation (medians)",
    fill = "Prosodic prominence"
  ) +
  scale_fill_manual(values = colorBlindBlack8) +
  theme_minimal()

ggsave(filename = paste0(plots, "prominence_fmDep_median_posttonic.png"), plot = last_plot(), width = 6, height = 4)

3.3.4.28 Frequency modulation (sd)

What is the average frequency modulation (sd) across the different prosodic prominence ratings in Catalan vs in German?

# Values
data_prepost %>% 
  group_by(language, percProm) %>%
  summarize(avg_fmDep_sd = mean(fmDep_sdPost, na.rm = TRUE))
# Plot
ggplot(data_prepost %>% filter(!is.na(percProm)), aes(x = language, y = fmDep_sdPost, fill = as.factor(percProm))) +
  geom_violin(scale = "width", trim = FALSE, alpha = 0.3) +
  geom_boxplot(width = 0.1, outlier.shape = NA, position = position_dodge(width = 0.9), alpha = 0.5) +
  labs(
    #title = "Duration of Prosodic Prominence Ratings by Language",
    x = "Language",
    y = "Posttonic frequency modulation (sd)",
    fill = "Prosodic prominence"
  ) +
  scale_fill_manual(values = colorBlindBlack8) +
  ylim(-0.1, 0.6) + # because of outliers
  theme_minimal()

ggsave(filename = paste0(plots, "prominence_fmDep_sd_posttonic.png"), plot = last_plot(), width = 6, height = 4)